Several tips about property dialogs (Property Sheet)
Wenyi
All of the following examples are assumed to have new classes from the CPropertySheet.
1, hide the apply button
Use the PSH_noApplyNow flag.
PropSheet.m_psh.dwflags | = psh_noapplynow;
2, add new sub-windows
Use member variables. Cedit m_edit.
Bool cmypropsheet :: oninitdialog ()
{
Bool Bresult = CPROPERTYSHEET :: OnInitdialog ();
CRECT RECTWND;
GetWindowRect (RectWnd);
SetwindowPos (NULL, 0, 0,
RectWnd.Width () 100,
RectWnd.Height (),
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
M_EDit.createex (WS_EX_CLIENTEDGE, _T ("Edit"), NULL,
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
RectWnd.Width (), 20, 80, 24, m_hwnd, 0, 0);
m_edit.setfont (getFont ());
CenterWindow ();
Return BRESULT;
}
3, change the font on the page
In OnInitDialog ():
// m_fontedit is a member variable
// Create a bold font
M_FONTEDIT.CREATEFONT (-8, 0, 0, 0, 700, 0, 0, 0, 1,
0, 0, 0, 0, _t ("MS SANS Serif");
GetTabControl () -> setFont (& m_fontedit);
4, use image
m_imagetab is a member variable. BOOL CMyPropSheet :: OnInitDialog () {BOOL bResult = CPropertySheet :: OnInitDialog (); m_imageTab.Create (IDB_TABIMAGES, 13, 1, RGB (255,255,255)); CTabCtrl * pTab = GetTabControl (); pTab-> SetImageList (& m_imageTab); Tc_Item.Mask = TCIF_Image; for (int i = 0; i <3; i ) {tcitem.iimage = i; ptab-> setItem (i, & tcitem);} return bresult;}
Excerpted from Yu Haiyuan http://www.mfc2000.yeah.net