|
-
Sep 10th, 2001, 10:50 AM
#1
Thread Starter
New Member
Form within a frame
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
-
Sep 10th, 2001, 11:09 AM
#2
Fanatic Member
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
Try this
-
Sep 10th, 2001, 11:45 AM
#3
Frenzied Member
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....
~Peter

-
Sep 10th, 2001, 11:55 AM
#4
Fanatic Member
Did you add a frame to form 1?
-
Sep 10th, 2001, 12:20 PM
#5
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.
-
Sep 10th, 2001, 12:25 PM
#6
Fanatic Member
*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.
-
Sep 10th, 2001, 12:28 PM
#7
*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.
-
Sep 10th, 2001, 01:42 PM
#8
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)
-
Sep 10th, 2001, 01:46 PM
#9
Fanatic Member
heh it is pretty nifty. You could conceivably put an mdi form on a form with mdi children, but that'd be silly
-
Sep 10th, 2001, 03:06 PM
#10
Frenzied Member
I got it to work by adding this code to the second form:
Code:
Private Sub Form_Load()
Me.Left = 0
Me.Top = 0
End Sub
And you also need to have Form2 set to be StartUpPosition = 0 at design time.
Very cool effect. Thanks guys.
~Peter

-
Dec 1st, 2001, 06:44 PM
#11
Junior Member
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*
-
Dec 2nd, 2001, 07:59 PM
#12
Frenzied Member
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.
~Peter

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|