码迷,mamicode.com
首页 > Windows程序 > 详细

非标题区域拖动窗体VB

时间:2020-03-28 01:05:07      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:top   div   bsp   需要   lse   class   The   single   标题栏   

窗体空白区域按下鼠标左键即可任意拖动窗体,不需要拖动标题栏。

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

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        MoveScreen = True
        MousX = X
        MousY = Y
    End If
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If MoveScreen Then
        CurrX = Form1.Left - MousX + X
        CurrY = Form1.Top - MousY + Y
        Form1.Move CurrX, CurrY
    End If
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    MoveScreen = False
End Sub

 

非标题区域拖动窗体VB

标签:top   div   bsp   需要   lse   class   The   single   标题栏   

原文地址:https://www.cnblogs.com/chenxiehan/p/12585337.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!