I want to be able to drag the form by click on the form.... not by clicking on the bar...
The formborderstyle is at None...
sorry for my english
Printable View
I want to be able to drag the form by click on the form.... not by clicking on the bar...
The formborderstyle is at None...
sorry for my english
Try this:
Code:Private Const WM_NCLBUTTONDOWN As Integer = &HA1S
Private Const HTCAPTION As Integer = &H2
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
Me.Capture = False
Dim msg As Message = Message.Create(Me.Handle, WM_NCLBUTTONDOWN, New IntPtr(HTCAPTION), IntPtr.Zero)
Me.DefWndProc(msg)
End Sub
Take a look at my signature, there's a link to a codebank submission for moving and resizing a Borderless Form using API calls. The resizing bit is a little complicated, but the moving part is really easy.
EDIT
After taking a second look, it seems that stanav's code does exactly the same, he just calls the required functions in a different way :p
OH! ty stanav! it work great!