how do i load a form in a picture box and at run time how do i drag and drop any object
Printable View
how do i load a form in a picture box and at run time how do i drag and drop any object
Use SetParent. Add this to a Form with a PictureBox.
Code:Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub Picture1_Click()
Dim frm As New Form1
frm.Show
SetParent frm.hWnd, Picture1.hWnd
End Sub
[Edited by Megatron on 11-18-2000 at 12:01 PM]
To drag an object:
Add to a Form with a PictureBox.
Code:Dim prevX As Single, prevY As Single
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
prevX = X
prevY = Y
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then Picture1.Move Picture1.Left + (X - prevX), Picture1.Top + (Y - prevY)
End Sub