Thursday, July 2, 2009

Override WinForm's Window position

Private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Integer, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
Private Const SWP_NOSIZE As Integer = &H1
'
' Will override the default position of the form and set it to whatever is specified
'

Dim hWnd As Integer = Me.Handle.ToInt32
SetWindowPos(hWnd, 0, 400, 200, 0, 0, SWP_NOSIZE)

No comments:

Post a Comment

Calling .NET From COM Originally posted by Mikec276 on C Sharp Friends It might be hard to convince your IT manager to let you build y...