11 Years
Discussion Span
Last Post by cybuster

i have one for you try this:

Dim blnDrag As Boolean
Dim xClickPos, yClickPos

Private Sub btnEnableDrag_Click()
If blnDrag = False Then
blnDrag = True
btnEnableDrag.Caption = "Disable Dragging"
blnDrag = False
btnEnableDrag.Caption = "Enable Dragging"
End If
End Sub

Private Sub btnEnableDrag_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
If State = 0 Then
Source.MousePointer = 12
ElseIf State = 1 Then
Source.MousePointer = 0
End If
End Sub

Private Sub Command1_Click()
If blnDrag = False Then MsgBox "Button Clicked"
End Sub
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If blnDrag Then
xClickPos = X
yClickPos = Y
Command1.Drag vbBeginDrag
End If
End Sub

Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Left = X - xClickPos
Source.Top = Y - yClickPos
End Sub
Private Sub Form_Load()
blnDrag = False
End Sub

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.