窗体没有边框怎么移动?
把一个窗体的formborderstyle属性设为None时,就不可以拖动了,怎么能让它没有边框还可以拖动
[解决办法]
Dim down As Boolean
Dim newPoint As Point
Private Sub UserControl1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
down = True
newPoint = New Point(e.X, e.Y)
End Sub
Private Sub UserControl1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If (down) Then
' 根据鼠标的移动,实际移动控件
Dim diffx, diffy As Integer
diffx = newPoint.X - e.X
diffy = newPoint.Y - e.Y
Me.Location = New Point(Me.Location.X - diffx, Me.Location.Y - diffy)
End If
End Sub
Private Sub UserControl1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
down = False
End Sub
很简单的......