Re: create font for all classes in a MFC project?
On 16 Aug., 13:17, David Lowndes <Dav...@example.invalid> wrote:
I`ve installed a public font object (CFont m_font;) in the specific
class; moreover I get the same error if I set the font using the
resource editor
You've got something odd happening in your code - quite what though I
don't know.
I suggest that you try an example project with just the font change
code in to reassure yourself that it's not the issue.
Dave
I got the error which was in my code;
By the way, a short question: if I want to use
SendMessageToDescendants( WM_SETFONT,(WPARAM) m_font.m_hObject );
for nearly every item in a dialog; how is it possible to define a new
font which should be only applied to some items?
When I use the same definition (only resize the font) and add the font
SetFont() to an item, nothing happens. If I don`t use
SendMessageToDescendants() the font will be shown as expected...
One short example:
OnInitDialog()
{
LOGFONT lF;
lF.lfHeight = 40;
lF.lfWidth = 0;
lF.lfWeight = FW_NORMAL;
lF.lfItalic = FALSE; //TRUE;
lF.lfUnderline = FALSE; //TRUE;
lF.lfStrikeOut = FALSE; //TRUE;
lF.lfEscapement = 0;
lF.lfOrientation = 0;
wcscpy(lF.lfFaceName,_T("Verdana"));
m_Statfont.CreateFontIndirect(&lF);
m_StatRefL.SetFont(&m_Statfont);
}
m_Statfont is a public member of the class.
best regards
Hans