Diana Borovina
August 2nd, 1999, 12:31 AM
I am using static text controls as labels. I want to make a few of these labels bold on my form. How do I do this
Regards Diana
Regards Diana
|
Click to See Complete Forum and Search --> : Making a Static text control Bold Diana Borovina August 2nd, 1999, 12:31 AM I am using static text controls as labels. I want to make a few of these labels bold on my form. How do I do this Regards Diana Genady August 2nd, 1999, 07:22 AM check "other controls" or "static" sections on this site. there is sample there that show derived from CStatic labels which use any font, any color, custom background .... I just don't remember article name. Genady August 2nd, 1999, 07:26 AM here it is August 2nd, 1999, 10:57 AM // CTestDlg.h class CTestDlg : public CDialog { ... protected: CFont m_BoldFont; ... }; // CTestDlg.cpp ... BOOL CTestDlg::OnInitDialog() { ... // Create bold font CFont* pFont=GetFont(); LOGFONT lf; pFont->GetLogFont(&lf); lf->lfWeight=FW_BOLD; m_BoldFont.CreateFontIndirect(&lf); ... } HBRUSH CTestDlg::OnCtlColor(CDC* pDC,CWnd* pWnd,UINT nCtlColor) { HBRUSH hbr=CDialog::OnCtlCOlor(pDC,pWnd,nCtlColor); switch (pWnd->GetDlgCtrlID()) { // add ID's of labels that should be displayed as bold case IDC_LABEL1: case IDC_LABEL2: pDC->SelectObject(&m_BoldFont); // Set bold font as default font in device context break; } return hbr; } codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |