Re: Fonts and Colors for Static Text Controls with MFC
- From: TJ <someone@xxxxxxxxxxxxx>
- Date: Fri, 24 Jun 2005 02:19:44 -0500
Use SetBkMode(TRANSPARENT).
Tom wrote:
I try so change font appearance and text colors using eVC++ 4 and MFC. Unfortunately it works not the way I think it should:
BOOL CMtrackerDlg::OnInitDialog() { CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow());
CClientDC dc(&m_DataSourceName_Static);
COLORREF cr = dc.GetTextColor();
cr = RGB(255,0,0);
dc.SetTextColor(cr);
m_DataSourceName_Static.SetWindowText(L"Test text ");
/*
CFont* pFont = m_DataSourceName_Static.GetFont();
LOGFONT lf;
pFont->GetLogFont(&lf);
lf.lfWeight = 900;
pFont->CreateFontIndirect(&lf);
m_DataSourceName_Static.SetFont(pFont);
*/
return TRUE;
}
m_DataSourceName_Static is of type CStatic. The text still displays black instead of read.
With the font I am also unlucky:
CFont* pFont = m_DataSourceName_Static.GetFont();
returns a NULL pointer.
What am I doing wrong??
Tom
.
- References:
- Prev by Date: MAC Address of Pocket PC
- Next by Date: How to know the PIE is launch from Start Menu
- Previous by thread: Fonts and Colors for Static Text Controls with MFC
- Next by thread: Process viewer
- Index(es):