Results 1 to 5 of 5

Thread: MDI Picture

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    If i have a standard form with a picture box on it. I want it so when you click a button it displays a form inside the picture box, to give the effect of 'MDI'.

  2. #2
    Guest
    Use the SetParent API.

    Code:
    Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    
    Private Sub Command1_Click()
    
        SetParent Form2.hwnd, Picture1.hwnd
        Form2.Show
    
    End Sub

  3. #3
    Guest

    Multiple Documents

    Better yet, use this code. It will allow multiple copies of Form2.

    Code:
    Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    Dim newForm As Form2
    
    Private Sub Command1_Click()
    
        Set newForm = New Form2
        SetParent newForm.hwnd, Picture1.hwnd
        newForm.Show
    
    End Sub

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    Cheers m8, exactly what i was looking for, ace bloke

  5. #5
    New Member
    Join Date
    Jan 2001
    Location
    Minnesota
    Posts
    15
    thanks that code helped me out to

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