Home > All Tags > 拖拽

[原创]VB.net Group Box 窗口内 自由 拖拽

评分 0.00, 满分 5星 0 票 No comments
#Region "Group Box 拖拽"

    Dim CurrX As Integer
    Dim CurrY As Integer
    Dim MousX As Integer
    Dim MousY As Integer
    Dim MovBoll As Boolean

    '*--将 gpbMATERIAL_INFO 更换为 自己Group Box的名字
    Private Sub gpbATT_FILE_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gpbMATERIAL_INFO.MouseDown
        MousX = e.X
        MousY = e.Y
        MovBoll = True
    End Sub

    Private Sub gpbATT_FILE_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gpbMATERIAL_INFO.MouseMove
         If MovBoll = True Then
            CurrX = sender.Left - MousX + e.X
            CurrY = sender.Top - MousY + e.Y
            sender.Location = New System.Drawing.Point(CurrX, CurrY)
        End If
    End Sub

    Private Sub gpbATT_FILE_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gpbMATERIAL_INFO.MouseUp
        MovBoll = False
    End Sub


#End Region