Dim iGrabX As Integer
Dim iGrabY As Integer
Dim ControlZOrder As Long
Private Sub Command1_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move Command1.Left + X - iGrabX, Command1.Top + Y - iGrabY
End Sub
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
iGrabX = X
iGrabY = Y
Command1.Drag vbBeginDrag
Else
ControlZOrder = Command1.hWnd
PopupMenu mnuPopUp
End If
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Command1.Drag vbEndDrag
End If
End Sub
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - iGrabX, Y - iGrabY
End Sub
Private Sub mnuBack_Click()
Dim i As Control
For Each i In Form1.Controls
If i.hWnd = ControlZOrder Then
i.ZOrder 1
Exit For
End If
Next i
End Sub
Private Sub mnuFront_Click()
Dim i As Control
For Each i In Form1.Controls
If i.hWnd = ControlZOrder Then
i.ZOrder
Exit For
End If
Next i
End Sub
Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move Picture1.Left + X - iGrabX, Picture1.Top + Y - iGrabY
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
iGrabX = X
iGrabY = Y
Picture1.Drag vbBeginDrag
Else
ControlZOrder = Picture1.hWnd
PopupMenu mnuPopUp
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Picture1.Drag vbEndDrag
End If
End Sub
Private Sub Text1_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move Text1.Left + X - iGrabX, Text1.Top + Y - iGrabY
End Sub
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
iGrabX = X
iGrabY = Y
Text1.Drag vbBeginDrag
Else
ControlZOrder = Text1.hWnd
PopupMenu mnuPopUp
End If
End Sub
Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Text1.Drag vbEndDrag
End If
End Sub
__________________
form elemanlarını taşımak Drag-drop olayı
Programlama0 Mesaj
●26 Görüntüleme
- ReadBull.net
- Programlama ve Yazılım
- Programlama
- form elemanlarını taşımak Drag-drop olayı