Nel form dove hai l'immagine, che hai chiamato Image1, copia questo
codice :
codice:
Option Explicit
Dim blDrag As Boolean
Dim oY As Single
Dim oX As Single
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
oY = 0
oX = 0
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
blDrag = True
oY = Y
oX = X
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not blDrag Then Exit Sub
Me.Move Me.Left - oX + X, Me.Top - oY + Y
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
blDrag = False
End Sub
Nota che devi prevedere il maccanismo per chiudere il form. Se è senza bordi e quindi senza i bottoni di controllo (Control Box),
potresti mettere un bottoncino piccolo con una X al cui click
fai un Unload Me (come nell'esempio).
Ciao,