1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| void CDlgCtrlPropTree::DisplayPage(CDlgCtrlPropPage* pTreePage)
{
int bOffset=0;
if(pTreePage->GetHeaderTitle() != _T(""))
{
// Set the height of the header
bOffset = m_iHeaderHeight;
CDC* pDC = this->GetDC();
DrawPageHeader(pDC,pTreePage);
ReleaseDC(pDC);
}
//Calculate correct size and position for pTreeCDlg
CRect rect(m_PageRect.left,m_PageRect.top+bOffset,m_PageRect.right,m_PageRect.bottom);
// Display pTreeCDlg and hide previous child dlg
pTreePage->SetWindowPos(&wndTop,rect.left,rect.top,rect.right-rect.left,
rect.bottom-rect.top,SWP_SHOWWINDOW);
if (m_pCurPage!=pTreePage)
{
m_pCurPage->ShowWindow(SW_HIDE);
m_pCurPage = pTreePage;
}
}
void CDlgCtrlPropTree::DrawPageHeader(CDC* pDC,CDlgCtrlPropPage* pTreePage)
{
CString strTitle = pTreePage->GetHeaderTitle();
// Test to know if a header exist
if(strTitle == _T(""))
return;
CRect rectBckgrndColor(m_PageRect.left+m_iMargin-2,m_PageRect.top+m_iMargin,m_PageRect.right-m_iMargin-2,m_iHeaderHeight-m_iMargin-2);
//Set Background color
pDC->FillSolidRect(rectBckgrndColor,_DARKGRAY);
CFont* pOldFont = pDC->SelectObject (&afxGlobalData.fontBold);
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor (_WHITE);
CRect rectTitleText(rectBckgrndColor.left+3,rectBckgrndColor.top,rectBckgrndColor.right,rectBckgrndColor.bottom);
pDC->DrawText (strTitle, rectTitleText, DT_SINGLELINE | DT_VCENTER | DT_LEFT);
pDC->SelectObject (pOldFont);
} |
Partager