vb中窗口里的UserControl控件怎样拖动?
我现在的情况是UserControl的属性DragMode=0时;MouseMove响应UserControl的属性DragMode=1时;MouseMove不响应怎样能...
我现在的情况是
UserControl的属性DragMode = 0时;MouseMove响应
UserControl的属性DragMode = 1时;MouseMove不响应
怎样能像VB自带的控件那样拖动
Option Explicit
Dim mX As Long, mY As Long
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button And vbLeftButton Then
mX = X: mY = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button And vbLeftButton Then
Me.Move Me.Left - mX + X, Me.Top - mY + Y
End If
End Sub
把form换成要移动的控件名称就可以实现移动了。
谢谢!!这个我也知道,原因我找到了,原来是ScoleMode=pixel惹的祸,一拖就消失了.
谁能告诉我当ScoleMode=pixel时,X和Y怎么算 展开
UserControl的属性DragMode = 0时;MouseMove响应
UserControl的属性DragMode = 1时;MouseMove不响应
怎样能像VB自带的控件那样拖动
Option Explicit
Dim mX As Long, mY As Long
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button And vbLeftButton Then
mX = X: mY = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button And vbLeftButton Then
Me.Move Me.Left - mX + X, Me.Top - mY + Y
End If
End Sub
把form换成要移动的控件名称就可以实现移动了。
谢谢!!这个我也知道,原因我找到了,原来是ScoleMode=pixel惹的祸,一拖就消失了.
谁能告诉我当ScoleMode=pixel时,X和Y怎么算 展开
1个回答
展开全部
Option Explicit
Dim mX As Long, mY As Long
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button And vbLeftButton Then
mX = X: mY = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button And vbLeftButton Then
Me.Move Me.Left - mX + X, Me.Top - mY + Y
End If
End Sub
把form换成要移动的控件名称就可以实现移动了。
Dim mX As Long, mY As Long
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button And vbLeftButton Then
mX = X: mY = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button And vbLeftButton Then
Me.Move Me.Left - mX + X, Me.Top - mY + Y
End If
End Sub
把form换成要移动的控件名称就可以实现移动了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询