在VB6中移动按钮

在VB6中移动按钮,vb6,Vb6,在VisualBasic中,是否可以使用鼠标拖动按钮进行移动,该按钮保持在同一水平线上,并且每次仅移动一定距离。类似于计算机声音上的平衡控制这里有一个简单的示例,可以拖动名为Command1的按钮。要限制它可以移动的距离,只需向DragOver事件添加一些条件: Dim blnDrag As Boolean Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

在VisualBasic中,是否可以使用鼠标拖动按钮进行移动,该按钮保持在同一水平线上,并且每次仅移动一定距离。类似于计算机声音上的平衡控制

这里有一个简单的示例,可以拖动名为Command1的按钮。要限制它可以移动的距离,只需向DragOver事件添加一些条件:

Dim blnDrag As Boolean
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Not blnDrag Then
        blnDrag = True
        Command1.Drag
    End If
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Command1.DragMode = vbnone
    blnDrag = False
End Sub
Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
    Command1.Left = X
End Sub
Private Sub Form_Load()
    Command1.DragMode = vbManual
End Sub

下面是一个简单的示例,可以拖动名为Command1的按钮。要限制它可以移动的距离,只需向DragOver事件添加一些条件:

Dim blnDrag As Boolean
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Not blnDrag Then
        blnDrag = True
        Command1.Drag
    End If
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Command1.DragMode = vbnone
    blnDrag = False
End Sub
Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
    Command1.Left = X
End Sub
Private Sub Form_Load()
    Command1.DragMode = vbManual
End Sub

从您想要做的描述中,我想知道您是否应该使用水平滚动条控件?从您想要做的描述中,我想知道您是否应该使用水平滚动条控件?