Form2.vb

(完整代码) 1KB

Public Class Form2

    Private mouse_offset As Point


    Private Sub PictureBox1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
        '按住鼠标左右键均可拖动窗体
        Dim pic As PictureBox = DirectCast(sender, PictureBox)
        If e.Button = MouseButtons.Left Or e.Button = MouseButtons.Right Then
            Dim mousepos As Point = Control.MousePosition
            '获得鼠标偏移量
            mousepos.Offset(-mouse_offset.X, -mouse_offset.Y)
            '设置窗体随鼠标一起移动
            Me.Location = mousepos
        End If

    End Sub

    Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown

        mouse_offset = New Point(e.X, e.Y)

    End Sub

    Private Sub PictureBox1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.DoubleClick

        Me.Close()

        Form1.ShowPopInfo()

    End Sub


    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。