Is it possible to call and use a form from within the frame of another form? If so, how would I do it?
Thanks in Advance
Printable View
Is it possible to call and use a form from within the frame of another form? If so, how would I do it?
Thanks in Advance
Try this :)VB Code:
Private Declare Function SetParent _ Lib "user32" ( _ ByVal hWndChild As Long, _ ByVal hWndNewParent As Long) As Long Private Sub form_load() SetParent Form2.hWnd, Frame1.hWnd Form2.Show End Sub
huh?
i started a new project, added a second from, and ran it, but nothing happened.
it didn't work for me - but maybe i'm missing something....
Did you add a frame to form 1?
I tried it as well, and it did work, but I was wondering if there would be a way to center the form inside the frame.
When I ran it, half the form was below the bottom of the frame, and trying to move the form around using its caption was a total trip.
*grin* just set the left/top properties of the form you're putting in the frame. You can also set the windows startup position to centerowner.
*grin* *grin*
I tried that already....unless I did something wrong (and I can't figure out how even I could screw a .Top .Left setting), it still did crazy things.
I've been playing with this, and I got it to work that way I want by playing with the screen properties of Form2 until it popped up, with the Frame on Form1, exactly where I wanted it.
Then, I set the border style of Form2 to 0 - None, and the controls on Form2 look just like they were placed there, rather than on a separate form.
What a great idea for a large wizard where you might run into the problem of too many controls on one form (that happened to me once)
heh it is pretty nifty. You could conceivably put an mdi form on a form with mdi children, but that'd be silly :)
I got it to work by adding this code to the second form:
And you also need to have Form2 set to be StartUpPosition = 0 at design time.Code:Private Sub Form_Load()
Me.Left = 0
Me.Top = 0
End Sub
Very cool effect. Thanks guys.
this works fine for me, but i have a few quetions:
When I maximize the form inside the frame, i still have the ability to move the frame around. :/ Is there a way to lock the form once maximized?
Also, when I move the form around in the frame and try to maximize, it makes the form the same size as the frame but does not properly make it maximized in the frame. How can I keep this from happening.
Thanks in advance. :)
*My First Post*
I removed the title bar from the form within the frame. Then the user has nothing to grab on to, so they can't move it.
And i set the form to be maximized on start up.
Worked fine for me.