VB.NET drags the boundless form

xiaoxiao2021-03-06  39

'************************************************** Private ooriginalRegion as region = nothing' For form mobile private bformdragging as boolean = falseprivate opointclicked as point

'************************************************

PRIVATE SUB FORM1_MOUSEDOWN (Byval e as system.windows.forms.mouseeventargs) Handles mybase.mousedown

Me.bformdragging = true.opointclicked = new point (E.x, E.Y)

End Sub '********************************************************

PRIVATE SUB FORM1_MOUSEUP (Byval e as system.windows.forms.mouseeventargs) Handles mybase.mouseupme.bformdragging = false

End Sub '********************************************************

Private Sub Form1_MouseMove (ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMoveIf Me.bFormDragging ThenDim oMoveToPoint As Point 'based on the current position of the mouse find the target position oMoveToPoint = Me.PointToScreen (New Point (EX, EY) 'This is made to adjust OMOVETOPOINT.OFFSET according to the start position (me.opointclicked.x * -1, _ (me.opointclicked.y _systeminformation.captionHeight _Systeminformation.Bordersize.Height) * -1)' Mobile Form me.location = omovetopointendiff

End Sub

转载请注明原文地址:https://www.9cbs.com/read-118562.html

New Post(0)