ÜnLoCo
Member
- Joined
- Jul 18, 2009
- Messages
- 8
- Programming Experience
- Beginner
hello
here's how to make a moveable form in case you let off the title bar
(formborderstyle = none )
if you have a better idea plz post it
here's how to make a moveable form in case you let off the title bar
(formborderstyle = none )
VB.NET:
Dim down, init, curpt As Point
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
init = Location
'record the form (initial) position
down = System.Windows.Forms.Control.MousePosition()
'record the cursor (initial) position
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
curpt = System.Windows.Forms.Control.MousePosition()
'get the current pos of the mouse cursor (step = every pixel)
Location = init + (curpt - down)
'simply add the difference(+/-) to the initial pos of the form
End If
End Sub
if you have a better idea plz post it