Click here to Skip to main content
15,903,175 members
Home / Discussions / C#
   

C#

 
Questionhow to use an icon in multiple places Pin
visiontec27-Feb-04 11:43
visiontec27-Feb-04 11:43 
AnswerRe: how to use an icon in multiple places Pin
Heath Stewart28-Feb-04 3:46
protectorHeath Stewart28-Feb-04 3:46 
GeneralIcons Pin
BigBlob20227-Feb-04 10:18
BigBlob20227-Feb-04 10:18 
GeneralRe: Icons Pin
Heath Stewart27-Feb-04 11:27
protectorHeath Stewart27-Feb-04 11:27 
GeneralRe: Icons Pin
BigBlob20227-Feb-04 12:08
BigBlob20227-Feb-04 12:08 
GeneralRe: Icons Pin
Heath Stewart28-Feb-04 3:21
protectorHeath Stewart28-Feb-04 3:21 
Questionwhat is wrong with code?? Pin
SherKar27-Feb-04 10:14
SherKar27-Feb-04 10:14 
AnswerRe: what is wrong with code?? Pin
Heath Stewart27-Feb-04 11:15
protectorHeath Stewart27-Feb-04 11:15 
Besides the fact that you can do all this without P/Invoking calls (using Form.Location and Form.Size, which you should use for portability and ease), you didn't mention how you declared the P/Invoked method, which should look like:
[DllImport("user32.dll")]
private static extern bool SetWindowPos(
  IntPtr hWnd,
  IntPtr hWndInsertAfter,
  [MarshalAs(UnmanagedType.SysInt)] int X,
  [MarshalAs(UnmanagedType.SysInt)] int Y,
  [MarshalAs(UnmanagedType.SysInt)] int cx,
  [MarshalAs(UnmanagedType.SysInt)] int cy,
  [MarshalAs(UnmanagedType.U4)] UINT uFlags);
Pass the Form.Handle property value as the first parameter.

Honestly, though - just stick with the properties already available on the Form class (some of which are inherited from Control). You don't need this function at all and will most likely break portability if you ever require it anyway.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: what is wrong with code?? Pin
Dave Kreskowiak27-Feb-04 16:43
mveDave Kreskowiak27-Feb-04 16:43 
GeneralRe: what is wrong with code?? Pin
SherKar27-Feb-04 20:55
SherKar27-Feb-04 20:55 
GeneralRe: what is wrong with code?? Pin
Heath Stewart28-Feb-04 3:28
protectorHeath Stewart28-Feb-04 3:28 
GeneralRe: what is wrong with code?? Pin
SherKar27-Feb-04 20:58
SherKar27-Feb-04 20:58 
GeneralPorting to C# Pin
Kant27-Feb-04 9:30
Kant27-Feb-04 9:30 
GeneralRe: Porting to C# Pin
Heath Stewart27-Feb-04 9:49
protectorHeath Stewart27-Feb-04 9:49 
GeneralRe: Porting to C# Pin
Kant27-Feb-04 10:31
Kant27-Feb-04 10:31 
GeneralRe: Porting to C# Pin
Heath Stewart27-Feb-04 11:08
protectorHeath Stewart27-Feb-04 11:08 
GeneralRe: Porting to C# Pin
Matthew Hazlett27-Feb-04 13:27
Matthew Hazlett27-Feb-04 13:27 
GeneralRe: Porting to C# Pin
Marc Clifton27-Feb-04 16:15
mvaMarc Clifton27-Feb-04 16:15 
GeneralRe: Porting to C# Pin
Kant28-Feb-04 18:53
Kant28-Feb-04 18:53 
GeneralRe: Porting to C# Pin
Giles29-Feb-04 0:15
Giles29-Feb-04 0:15 
GeneralResizing form background image Pin
Flack27-Feb-04 9:10
Flack27-Feb-04 9:10 
GeneralRe: Resizing form background image Pin
Heath Stewart27-Feb-04 9:59
protectorHeath Stewart27-Feb-04 9:59 
QuestionFileIOPermission also takes away UIPermission? Pin
Nathan Blomquist27-Feb-04 8:37
Nathan Blomquist27-Feb-04 8:37 
AnswerRe: FileIOPermission also takes away UIPermission? Pin
Heath Stewart27-Feb-04 9:38
protectorHeath Stewart27-Feb-04 9:38 
GeneralRe: FileIOPermission also takes away UIPermission? Pin
Nathan Blomquist27-Feb-04 11:21
Nathan Blomquist27-Feb-04 11:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.