Hi,
How to move a form without controlbox?
Help please ...
Thanks
control box?
u mean title bar?
using API files i think..
See if this helps.
'// paste in New Project and click to move Form.
'//-- Panel1 and PictureBox1 can be uncommented to use the same Events.
'//-- to use only a Panel, PictureBox, or any other control, just add the appropriate code for each event.
Public Class Form1
Private allowCoolMove As Boolean = False
Private myCoolPoint As New Point
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles Me.MouseDown ', Panel1.MouseDown, PictureBox1.MouseDown
allowCoolMove = True '// enable move.
myCoolPoint = New Point(Cursor.Position.X - Me.Location.X, Cursor.Position.Y - Me.Location.Y) '// get coordinates.
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles Me.MouseMove ', Panel1.MouseMove, PictureBox1.MouseMove
If allowCoolMove = True Then
Me.Location = New Point(Cursor.Position.X - myCoolPoint.X, Cursor.Position.Y - myCoolPoint.Y) '// set coordinates.
End If
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles Me.MouseUp ', Panel1.MouseUp, PictureBox1.MouseUp
allowCoolMove = False '// disable move.
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End Sub
End Class
Works fine but is there's other way to move like controlbox?
Set .WindowState of a Form to Maximized/Minimized/Normal?
Me.WindowState = FormWindowState.Maximized
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.