|
-
August 2nd, 1999, 12:31 AM
#1
Making a Static text control Bold
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
-
August 2nd, 1999, 07:22 AM
#2
Re: Making a Static text control Bold
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.
-
August 2nd, 1999, 07:26 AM
#3
http://www.codeguru.com/staticctrl/label_static.shtml
-
August 2nd, 1999, 10:57 AM
#4
Re: Making a Static text control Bold
// 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;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|