font size of dialog box 
Author Message
 font size of dialog box

Does any one know how to change the font size of a control
box?  My control is created from the resource view.  I
looked into the property of the window.  But to do it from
there, once the font size is changed, the whole box is
enlarged, and every control on the dialog box will be
changed.  I would like to change the font size of a single
control box without changing the box size.  Please help


Tue, 30 Aug 2005 18:24:43 GMT  
 font size of dialog box
See if KB article

            Q85518 - INFO: Correct Use of the SetFont() Function in MFC

    helps you.

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------


Quote:
> Does any one know how to change the font size of a control
> box?  My control is created from the resource view.  I
> looked into the property of the window.  But to do it from
> there, once the font size is changed, the whole box is
> enlarged, and every control on the dialog box will be
> changed.  I would like to change the font size of a single
> control box without changing the box size.  Please help



Tue, 30 Aug 2005 19:00:49 GMT  
 font size of dialog box

Quote:

>Does any one know how to change the font size of a control
>box?  My control is created from the resource view.  I
>looked into the property of the window.  But to do it from
>there, once the font size is changed, the whole box is
>enlarged, and every control on the dialog box will be
>changed.  I would like to change the font size of a single
>control box without changing the box size.  Please help

You'll have to send it a WM_SETFONT message, and the easiest way is to bind
a control to it with ClassWizard and call SetFont on it. Make sure the font
outlives the control. One way is to add a CFont member variable to your
dialog class and use that font. To change just the font size, you first need
to obtain the control's current font. Here's how I added underlining to a
control's font, which is a similar problem:

   // This code was actually in the control's PreSubclassWindow override.
   CFont* pFont = GetFont();
   if (!pFont)
   {
      pFont = GetParent()->GetFont();
      if (!pFont)
      {
         if (HFONT hFont =
static_cast<HFONT>(GetStockObject(DEFAULT_GUI_FONT)))
            pFont = CFont::FromHandle(hFont);
      }
   }
   if (pFont)
   {
      LOGFONT lf;
      pFont->GetLogFont(&lf);
      lf.lfUnderline = true;
      if (m_font.CreateFontIndirect(&lf))
         SetFont(&m_font);
   }

--
Doug Harrison
Microsoft MVP - Visual C++



Tue, 30 Aug 2005 19:24:54 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to set different font sizes for Dialog box properties

2. How to change the color,size,font of text in a dialog box

3. Dialog box and font size...

4. How to change the color,size,font of text in a dialog box

5. font size in Edit Box

6. how to change edit box font size?

7. Changing font size and color on a dialog

8. Changing dialog default font size

9. Font size and color of the IDC_STATIC of the Dialog project

10. Changing font size and color on a dialog

11. Dialog immune to display font size - Solution-Test

12. Different dialog sizes with different fonts

 

 
Powered by phpBB® Forum Software