Changing fonts again.
Can someone help me with a font problem?
In the code below I am trying to set the font for the c_info text variable.
Whether I use FF_SWISS or FF_SCRIPT or any other the displayed text is
allways the same.
Changing the height, width, weight, italic... all work and do change the
displayed text.
How do I change the actual font used? Like to Courier, Times, Script, or any
other font available.
In the .h file under I have:
protected:
CFont InfoFont;
BOOL CEcolorDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
LOGFONT lf;
lf.lfHeight = 15;
lf.lfWidth = 5;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = FW_NORMAL;
lf.lfItalic = FALSE;
lf.lfUnderline = FALSE;
lf.lfStrikeOut = FALSE;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfOutPrecision = OUT_STROKE_PRECIS;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = PROOF_QUALITY;
// lf.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
lf.lfPitchAndFamily = VARIABLE_PITCH | FF_SCRIPT;
_tcscpy(lf.lfFaceName, _T("Arial"));
InfoFont.CreateFontIndirect(&lf);
c_info.SetFont(&InfoFont); //c_info is the static text variable
c_info.SetWindowText("System Ready");
//The rest of my initialization here
return TRUE;
}
Thanks,
Ed