Results 1 to 21 of 21

Thread: [RESOLVED] Forms in a picture box?

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    93

    [RESOLVED] Forms in a picture box?

    alrighty, here's what want to do.
    On the left of my program, there is a tree view, and when a node is clicked, to the right of the tree, a new form loads.

    Now, originally I was using an MDI form, with the trv in one child form, and then loading the other forms as children as well. This was working fine, but then I saw in another post, when looking for help on something else, a suggestion to use a picturebox to the left of the trv in the same form, and using the following (from here :
    VB Code:
    1. Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    2.  
    3. Private Sub Form_Load()
    4.  
    5. SetParent Frame1.hWnd, Picture2.hWnd

    I changed the code a little, I have a module, and in that mod there is a sub that is called for each form load (except the main one), so I added the code into the module instead of each form:
    VB Code:
    1. Public Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    2.  
    3. Public Sub FormInit(frmRef As Form)
    4.     SetParent frmRef.hWnd, frmMainScreen.pctFormContain.hWnd

    but whenever I click on a node, not only does nothing load in the picture box, the whole app seems to lose focus as well, any ideas?
    Last edited by thetakerfan; Feb 15th, 2003 at 01:09 AM.

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