|
-
October 12th, 2005, 04:03 PM
#1
How to set default size of MDI child frame?
I would like to make my MDI child frames come up at a larger size. Is there an easy way to do this? How does MFC determine the default size?
Actually, even better might be to have them come up already maximized.
thanks!
-
October 13th, 2005, 01:03 AM
#2
Re: How to set default size of MDI child frame?
Check this one:
CWnd::SetWindowPos
useful one..
if helped dont forget to "Rate this post"
It takes seconds for rating…that actually compensates the minutes taken for giving answers
The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
Regards, Be generous->Rate people
Jayender!!
-
October 13th, 2005, 04:08 AM
#3
-
October 13th, 2005, 05:04 AM
#4
Re: How to set default size of MDI child frame?
 Originally Posted by jayender.vs
This should work :
this should work !!
Well... Almost. Your code will prevent the MDI children from ever getting minimized or restored. Your ActivateFrame implementation should actually look like this:
Code:
void CChildFrame::ActivateFrame(int nCmdShow)
{
if (nCmdShow == -1)
{
nCmdShow = SW_SHOWMAXIMIZED;
}
CMDIChildWnd::ActivateFrame(nCmdShow);
}
-
October 13th, 2005, 07:12 AM
#5
Re: How to set default size of MDI child frame?
I believe PreCreateWindow() would be the correct place to do it. You'll be handed a CREATESTRUCT. Set its members appropriately. ActivateFrame will be called any time that window is activated or deactivated, and I don't think you want to resize it every time.
-
October 13th, 2005, 07:14 AM
#6
Re: How to set default size of MDI child frame?
 Originally Posted by jayender.vs
This should work :
Code:
void CChildFrame::ActivateFrame(int nCmdShow)
{
// Update window size
nCmdShow = SW_SHOWMAXIMISED;
CMDIChildWnd::ActivateFrame(nCmdShow);
}
this should work !!
if helped dont forget to " Rate this post"
Actually it won't. What happens if the user changes the size, switches to another view, then comes back to this one?
-
October 13th, 2005, 07:23 AM
#7
-
October 13th, 2005, 08:18 AM
#8
Re: How to set default size of MDI child frame?
 Originally Posted by jayender.vs
Actually  ,it will !!
its working perfectly dude....
dont get 
It's an MDI app. Open two windows. Resize 1. Switch to the second, switch back to the first. Doesn't the activate code get triggered again and resize the window when you switch back to it?
Regardless, PreCreateWindow is the normal place to do your initial sizing. It's provided for just that purpose.
-
October 13th, 2005, 02:09 PM
#9
Re: How to set default size of MDI child frame?
Thanks guys... I'll try out these methods and see which one works out (and rate accordingly :-) )
-
October 14th, 2005, 02:37 AM
#10
Re: How to set default size of MDI child frame?
Well, both things work.
ActivateFrame appears to be called only once, even if I switch between mdi children, maximize, restore, etc...
But I've decided to take the PreCreateWindow route...
-
October 14th, 2005, 02:40 AM
#11
Re: How to set default size of MDI child frame?
Actually, PreCreateWindow doesn't work so well, because if I increase the size, MFC starts putting these things off the MDI area, and the user has to move them completely back on (e.g. the bottom is clipped).
It looks like MFC uses some percentage of the actually app size to determine the size of child windows. So maybe I'll just adjust my default app size.
-
October 14th, 2005, 02:48 AM
#12
Re: How to set default size of MDI child frame?
Good .. to know it works well..
well .. the best place is PreCreateWindow , but it does make much difference as i said before .
It takes seconds for rating…that actually compensates the minutes taken for giving answers
The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
Regards, Be generous->Rate people
Jayender!!
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
|