|
-
September 7th, 1999, 01:39 PM
#1
How resize CChildFrm initialy
Hi everyone,
I'm trying to resize my CChildWnd in PrecreateWindow function, let say I wona it take half of Main Frame client area, I've used code below:
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
CMainFrame* pMain=(CMainFrame*)AfxGetMainWnd();
CRect rect;
pMain->GetClientRect(&rect);
cs.cx=rect.Width()/2;
cs.cy=rect.Height();
cs.x=0; cs.y=0;
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
But I have two problem
1. It works only for weight of window, I got height bigger than client area of Main Frame. (Is tool bar including in client area? if yes how to calculate it's height, I've tried RecalculateLayout(), it doesn't help)
2. If changed in InitInstance pMainFrame->ShowWindow(m_nCmdShow);
to pMainFrame->ShowWindow(SW_SHOWMAXIMIZED); function GetClientRect() still return old coordinate of not maximized frame.
What's wrong and how I may fix it?
Any suggestin realy appreciate.
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
|