Results 1 to 3 of 3

Thread: form and picture box

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 1999
    Posts
    204
    how do i load a form in a picture box and at run time how do i drag and drop any object
    WHat would we do with out Microsoft.
    A lot more.

  2. #2
    Guest
    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]

  3. #3
    Guest
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width