15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


StatusBar/ControlBar and MainFrame client area

Ari Villaca -- villaca@correionet.com.br
Wednesday, January 08, 1997

Environment: MSVC 4.0/Win95

After the MDI application mainframe is created, I create 3 MDIChildWindow=
s
as
bellow:
=09
XXXXXXXXXXXXXXXXX
X         X                      X
X         X                      X=20
X         X                      X=20
X         X                      X=20
XXXXXXXXXXXXXXXXX
X                                 X
XXXXXXXXXXXXXXXXX

I use the AfxGetMainWnd()->GetClientRect( TheRect ) to get the client are=
a
coordinates in order to move my ChildWindows to the correct place. The
problem is the mainframe has a status bar and a toolbar and because of
this, parts of the ChildWindows are offset and hidden.

I would like to make sure the child windows are allways completely visibl=
e
even if the user turns off the status bar, close or moves the control bar.

Any help appreciated,

Ari

-------------------------------------------------------------------------=
---
---
 Ari de Moura Villa=E7a
 					e-Mail:	villaca@correionet.com.br

 Av. Moraes Sales, 987 Apto.113		fone:	+55 19 232-2440
 13010-001 - Campinas, SP		fax:	+55 19 232-2440
 Brasil
-------------------------------------------------------------------------=
---
---




Mathias Olausson -- mathias.olausson@lig.linnedata.se
Friday, January 10, 1997

[Mini-digest: 4 responses]

>I use the AfxGetMainWnd()->GetClientRect( TheRect ) to get the client a=
rea
>coordinates in order to move my ChildWindows to the correct place. The
>problem is the mainframe has a status bar and a toolbar and because of
>this, parts of the ChildWindows are offset and hidden.

The area inside a CFrameWnd can be populated by toolbars, a statusbar, e=
tc. but 
always with a CMDIChildWnd, which is where the views will fit.
One way to solve your problem is to create your own CMDIChildWnd class a=
nd
use it when creating your document template, for instance:

=09AddDocTemplate( new CMultiDocTemplate( IDR=5FRESOURCE,
=09=09=09=09RUNTIME=5FCLASS( CMyDoc ),
=09=09=09=09RUNTIME=5FCLASS( CMyMDIChildWnd ),=09// =3C--
=09=09=09=09RUMTIME=5FCLASS( CMyView ) ) )=3B

The CMDIChildWnd object will occupy the area inside toolbars and statusb=
ar.
Or you can go directly and get a pointer to the MDICHILD window and get =
its size:

=09AfxGetMainWnd( )->GetWindow( GW=5FCHILD )->GetClientRect( =26rc )=3B

Hope this helps,
Mathias Olausson
Linn=E9 Data AB
-----From: Severino Delaurenti 

Hi Ari,

Use the following code if you want to determine the MDI client area:


RECT			rMDI;
CMDIFrameWnd	*pMainFrame = (CMDIFrameWnd *) AfxGetMainWnd ();

::GetWindowRect (pMainFrame->m_hWndMDIClient, &rMDI);
pMainFrame->ScreenToClient (&rMDI);

CRect	rectMDI (rMDI);



rectMDI is the CRect containing the effective size of the MDI area.

Hope this help.
Bye,

				Severino Delaurenti
				del@alpha.ico.olivetti.com
				Olivetti Lexikon Spa
				Italy

----------
From: 	Ari Villaca[SMTP:villaca@correionet.com.br]
Sent: 	08 January 1997 23:14
To: 	mfc-l@netcom.com
Subject: 	StatusBar/ControlBar and MainFrame client area

Environment: MSVC 4.0/Win95

After the MDI application mainframe is created, I create 3 MDIChildWindows
as
bellow:

ecc.

-----From: Joe Willcoxson 

At 08:14 PM 1/8/97 -0200, you wrote:
>Environment: MSVC 4.0/Win95
>
>After the MDI application mainframe is created, I create 3 MDIChildWindows
>
>I use the AfxGetMainWnd()->GetClientRect( TheRect ) to get the client area
>coordinates in order to move my ChildWindows to the correct place. The
>problem is the mainframe has a status bar and a toolbar and because of
>this, parts of the ChildWindows are offset and hidden.
>
>I would like to make sure the child windows are allways completely visible
>even if the user turns off the status bar, close or moves the control bar.

If you have an MDI application, what you want is the size of the MDI client
window which manages all of the MDI child windows:

::GetClientRect(((CMDIFrameWnd*)AfxGetMainWnd())->m_hWndMDIClient, &TheRect);

--
Gloria in excelsius Deo
Joe Willcoxson (joew@statsoft.com), Senior Software Engineer
Visit us: http://www.statsoft.com, Visit me: http://users.aol.com/chinajoe
#define STD_DISCLAIMER "I speak only for myself"
__cplusplus spoken here;

-----From: Mike Marshall 

You want the MDI client area, not the client area of the main frame
  window.  CMDIFrameWnd has a member called m_hWndMDIClient.
 To get area that remains after the status bar and control bars are
positioned, try the following:

Crect rect;
::GetClientRect(m_hWndMDIClient, &rect);
 =20

----------
From:  Ari Villaca[SMTP:villaca@correionet.com.br]
Sent:  Wednesday, January 08, 1997 4:14 PM
To:  mfc-l@netcom.com
Subject:  StatusBar/ControlBar and MainFrame client area

Environment: MSVC 4.0/Win95

After the MDI application mainframe is created, I create 3 =
MDIChildWindows
as
bellow:
=09
XXXXXXXXXXXXXXXXX
X         X                      X
X         X                      X=20
X         X                      X=20
X         X                      X=20
XXXXXXXXXXXXXXXXX
X                                 X
XXXXXXXXXXXXXXXXX

I use the AfxGetMainWnd()->GetClientRect( TheRect ) to get the client =
area
coordinates in order to move my ChildWindows to the correct place. The
problem is the mainframe has a status bar and a toolbar and because of
this, parts of the ChildWindows are offset and hidden.

I would like to make sure the child windows are allways completely =
visible
even if the user turns off the status bar, close or moves the control =
bar.

Any help appreciated,

Ari

-------------------------------------------------------------------------=
---
---
 Ari de Moura Villa=E7a
 					e-Mail:	villaca@correionet.com.br

 Av. Moraes Sales, 987 Apto.113		fone:	+55 19 232-2440
 13010-001 - Campinas, SP		fax:	+55 19 232-2440
 Brasil
-------------------------------------------------------------------------=
---
---





Dong Chen -- d_chen@ix.netcom.com
Saturday, January 11, 1997

>I use the AfxGetMainWnd()->GetClientRect( TheRect ) to get the client area
>coordinates in order to move my ChildWindows to the correct place. The
>problem is the mainframe has a status bar and a toolbar and because of
>this, parts of the ChildWindows are offset and hidden.
>

Call the  AdjustWindowRect() or AdjustWindowRectEx() function after that to
take them into account. See the on-line help document for these functions
for detail.
--
Dong
d_chen@ix.netcom.com




Kenneth A. Argo -- argo@rias.COM
Monday, January 13, 1997

If my memory serves me correctly, neither of these 2 functions takes =
into account any information about toolbars, status bars or even menus =
when they wrap to multiple lines.  I believe you will have to calculate =
the items individually be adding up the visible components and adjust =
from there.

Ken



----------
From:  Dong Chen[SMTP:d_chen@ix.netcom.com]
Sent:  Saturday, January 11, 1997 1:04 PM
To:  mfc-l@netcom.com
Subject:  Re: StatusBar/ControlBar and MainFrame client area

>I use the AfxGetMainWnd()->GetClientRect( TheRect ) to get the client =
area
>coordinates in order to move my ChildWindows to the correct place. The
>problem is the mainframe has a status bar and a toolbar and because of
>this, parts of the ChildWindows are offset and hidden.
>

Call the  AdjustWindowRect() or AdjustWindowRectEx() function after that =
to
take them into account. See the on-line help document for these =
functions
for detail.
--
Dong
d_chen@ix.netcom.com






| Вернуться в корень Архива |