|
-
April 1st, 1999, 08:14 AM
#1
Changing Default Font in a Dialog
I have a dialog based application that is used by users with various screen
resolutions. I use a default font set up in the resource editor
(10 pt. MS Sans Serif). This works fine on the higher resolution screens but in
800x600 it is too big to fit on the screen. If I use an 8 pt. font, it looks
better in low res but is too small in high res. I have been trying to change the
font on the fly by using the following code in the OnInitDialog;
d_dfont = GetFont();
d_dfont->GetLogFont(&d_lf);
d_dfont = new CFont();
d_lf.lfHeight -= 2;
d_dfont->CreateFontIndirect(&d_lf);
SetFont(d_dfont);
CClientDC dc(this);
dc.SelectObject(d_dfont);
This has no apparent affect. I have tried the same thing in the OnSetFont and
OnPaint functions also to no avail. What I want to do is to test the screen
resolution and then set the default font before displaying the dialog. Does
anyone know how this can be done?
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
|