日期:2009-07-30  浏览次数:20472 次

注意:要设置form的controlbox属性为false,

特别注意: form.text要设置为空,否则不会把标题栏去掉

Dim MousX As Integer

Dim MousY As Integer

Dim CurrX As Integer

Dim CurrY As Integer

 

 Public Sub myMouseDown(ByVal sender As Object, ByVal ex As MouseEventArgs) Handles MyBase.MouseDown

        If ex.Button = MouseButtons.Left Then

            '如果是鼠标左键,则不捕获鼠标

            Me.Capture() = False

 

            '获得鼠标坐标(相对于窗体)

            MousX = ex.X

            MousY = ex.Y

        End If

    End Sub

 

    Public Sub myMouseMove(ByVal sender As Object, ByVal ex As MouseEventArgs) Handles MyBase.MouseMove

        If ex.Button = MouseButtons.Left Then

            '左键操作