本文整理汇总了C++中CFrameWnd::CalcWindowRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CFrameWnd::CalcWindowRect方法的具体用法?C++ CFrameWnd::CalcWindowRect怎么用?C++ CFrameWnd::CalcWindowRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFrameWnd
的用法示例。
在下文中一共展示了CFrameWnd::CalcWindowRect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSize
void CSnapView::OnSize(UINT nType, int cx, int cy)
{
if (nType != SIZE_MINIMIZED && cx != 0 && cy != 0 && m_pPropSheet != NULL)
{
if (m_bSizedBefore == FALSE)
{
m_bSizedBefore = TRUE;
// get the size of the property sheet
CRect rectSized;
m_pPropSheet->GetWindowRect(rectSized);
// calculate the size of the frame
CFrameWnd* pFrame = GetParentFrame();
if (pFrame != NULL)
{
pFrame->CalcWindowRect(rectSized);
CWnd* pParent = pFrame->GetParent();
if (pParent != NULL)
pParent->ScreenToClient(rectSized);
// resize and reposition the frame
pFrame->MoveWindow(rectSized);
}
}
}
}
示例2: Create
BOOL CSnapView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
ENSURE(pParentWnd != NULL);
ASSERT_KINDOF(CFrameWnd, pParentWnd);
if (!CWnd::Create(lpszClassName, lpszWindowName, dwStyle | WS_CLIPCHILDREN,
rect, pParentWnd, nID, pContext))
{
return FALSE;
}
// add your pages here!
m_pPageBkfst = new CBkfstPage;
m_pPageLunch = new CLunchPage;
m_pPageDinner = new CDinnerPage;
// create the window object
m_pPropSheet = new CSnapPropertySheet;
m_pPropSheet->AddPage(m_pPageBkfst);
m_pPropSheet->AddPage(m_pPageLunch);
m_pPropSheet->AddPage(m_pPageDinner);
// create a modeless property page
if (!m_pPropSheet->Create(this,
DS_CONTEXTHELP | DS_SETFONT | WS_CHILD | WS_VISIBLE))
{
DestroyWindow();
return FALSE;
}
m_pPropSheet->SetWindowPos(NULL, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE);
// we use the style from the template - but make sure that
// the WS_BORDER bit is correct.
// the WS_BORDER bit will be whatever is in dwRequestedStyle
m_pPropSheet->ModifyStyle(WS_BORDER|WS_CAPTION,
dwStyle & (WS_BORDER|WS_CAPTION));
// Force the size requested.
// Fake a call to OnSize()--it would have been called automatically
// if this were using the base class implementation of Create().
CFrameWnd* pParentFrame = GetParentFrame();
CRect rectSize;
m_pPropSheet->GetWindowRect(rectSize);
pParentFrame->CalcWindowRect(rectSize);
OnSize(SIZE_RESTORED, rectSize.Width(), rectSize.Height());
return TRUE;
}
示例3: OnSize
void CMFCMDIPlayerView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
if (cy && cx)
{
// calculate the size of the frame
CFrameWnd* pFrame = GetParentFrame();
if (pFrame != NULL)
{
CRect rectSized(0, 0, cx, cy);
pFrame->CalcWindowRect(rectSized);
pFrame->SetWindowPos(this,0,0,rectSized.Width() + 4,rectSized.Height()+ 4, SWP_NOZORDER | SWP_NOMOVE );
}
}
}
示例4: OnNotifySize
LONG CMCIWndDemoView::OnNotifySize(UINT wParam, LONG lParam)
{
CRect rcMCI;
CFrameWnd* pParent = GetParentFrame();
if(m_hMCIWnd)
{
::GetWindowRect(m_hMCIWnd, rcMCI);
pParent->CalcWindowRect(rcMCI, CWnd::adjustBorder);
CSize size(rcMCI.Width(), rcMCI.Height());
if(GetExStyle() & WS_EX_CLIENTEDGE)
{
size.cx += 4;
size.cy += 44;
}
pParent->SetWindowPos(NULL, 0, 0, size.cx, size.cy, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE);
}
else
{
pParent->SetWindowPos(NULL, 0, 0, 320, 160, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE);
}
return 1L;
}