Using VB.NET 2005 and I have a form that I want to be able to drag around by clicking anywhere in the form window. I achieve this by using the below code that has been posted on this site several times. The problem is: after I add this code to a form any time I make changes in the code for the form and then switch back to the design view of that form the form is resizing itself to a smaller size. So if my form size is (453, 200) , after making some changes and going back into the design view the form will all of a sudden be (449, 196). This keeps happening over and over, the form keeps getting smaller ! So I am constantly having to change the size of the form back and move the controls around again to reposition them. Any idea why this is happening ? Is there a way to prevent this ? Any help would be greatly appreciated ! Thanks !
Const WM_NCHITTEST As Integer = &H84
Const HTCLIENT As Integer = &H1
Const HTCAPTION As Integer = &H2
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Select Case m.Msg
If m.Result.ToInt32 = HTCLIENT Then m.Result = IntPtr.op_Explicit(HTCAPTION)