Tema: drag&drop
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/05/2007, 16:31
Avatar de seba123neo
seba123neo
 
Fecha de Ingreso: febrero-2007
Ubicación: Esperanza, Santa Fe
Mensajes: 1.046
Antigüedad: 18 años, 2 meses
Puntos: 19
Re: drag&drop

aca tenes un ejemplo de como hacer un drag & drop de un PictureBox por el formulario,sin tener que ponerle ,ni cambiarle ninguna propiedad al picture box.

pone un picturebox en el formulario,y este codigo:

Dim iGrabX As Integer
Dim iGrabY As Integer
Dim ControlZOrder As Long

Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - iGrabX, Y - iGrabY
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
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

saludos.
__________________
" Todos Somos Ignorantes; lo que pasa es que no todos ignoramos las mismas cosas " - Albert Einstein