Win Forms Positioning

  • Thread starter Thread starter Shane Story
  • Start date Start date
S

Shane Story

I need to position a normal form at a certain position above another
form....mainly I would like it to have
a left of 0 (far left) and its top to start just below my toolbar.

Other than using GetSystemMetrics API to determine height of menu and win
caption, I have no idea how to do this.

Any ideas? Or is that the only way?

thanks,

Shane
 
Hi,

You can use the setwindowpos function. Use the hwnd_topmost
flag to make window a topmost window.

Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal
hwnd As Integer, _
ByVal hWndInsertAfter As Integer, ByVal x As IntPtr, ByVal y As
Integer, _
ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer)
As Integer

Const HWND_TOPMOST As Integer = -1
Const SWP_NOMOVE As Integer = &H2
Const SWP_NOSIZE As Integer= &H1

SetWindowPos(Me.Handle.ToInt32, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE +
SWP_NOSIZE)


Ken
------------------------
I need to position a normal form at a certain position above another
form....mainly I would like it to have
a left of 0 (far left) and its top to start just below my toolbar.

Other than using GetSystemMetrics API to determine height of menu and win
caption, I have no idea how to do this.

Any ideas? Or is that the only way?

thanks,

Shane
 
Back
Top