CalcWindowRect

王朝百科·作者佚名  2010-04-15  
宽屏版  字体: |||超大  

CWnd::CalcWindowRect

virtual void CalcWindowRect( LPRECT lpClientRect, UINT nAdjustType = adjustBorder );

Parameters

lpClientRect

Points to a RECT structure or CRect object that contains the resultant value of the window rectangle.

nAdjustType

An enumerated type used for in-place editing. It can have the following values: CWnd::adjustBorder = 0, which means that scroll-bar sizes are ignored in calculation; and CWnd::adjustOutside = 1, which means that they are added into the final measurements of the rectangle.

Remarks

Call this member function to compute the required size of the window rectangle based on the desired client-rectangle size. The resulting window rectangle (contained in lpClientRect) can then be passed to the Create member function to create a window whose client area is the desired size.

Called by the framework to size windows prior to creation.

A client rectangle is the smallest rectangle that completely encloses a client area. A window rectangle is the smallest rectangle that completely encloses the window.

Example

// Uses CalcWindowRect to determine size for new CFrameWnd

// based on the size of the current view. The end result is a

// top level frame window of the same size as CMyView's frame.

void CMyView::OnMyCreateframe()

{

CFrameWnd* pFrameWnd = new CFrameWnd;

CRect myRect;

GetClientRect(myRect);

pFrameWnd->Create(NULL, "My Frame");

pFrameWnd->CalcWindowRect(&myRect, CWnd::adjustBorder);

pFrameWnd->MoveWindow(0, 0, myRect.Width(), myRect.Height());

pFrameWnd->ShowWindow(SW_SHOW);

}

CWnd Overview | Class Members | Hierarchy Chart

See Also ::AdjustWindowRectEx

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝百科 版权所有