非标题区域拖动窗体VB
Posted chenxiehan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了非标题区域拖动窗体VB相关的知识,希望对你有一定的参考价值。
窗体空白区域按下鼠标左键即可任意拖动窗体,不需要拖动标题栏。
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的主要内容,如果未能解决你的问题,请参考以下文章