Different Font when creating buttons dynamically 
Author Message
 Different Font when creating buttons dynamically

I'm creating several CButton objects (radio buttons, group boxes, etc.)
using Create without a dialog resource.  They are created using a different
default font than the one used in standard dialogs.  Why is this and how can
I make them use the same font?

Thanks



Sun, 25 Nov 2001 03:00:00 GMT  
 Different Font when creating buttons dynamically
You can use YourRadioButtonControl->SetFont( font, REDRAW ). You might have
to hunt around in Character Map to identify which font is used by the dialog
editor.
HTH


Sun, 25 Nov 2001 03:00:00 GMT  
 Different Font when creating buttons dynamically
I tried to use SetFont within the CButton class but it didn't seem to work.
I haven't dug into it too deeply, yet.  I'll do that tomorrow.  I guess it
just seems strange to me that there isn't a simply way to make all controls
use the same font as is used in the dialog boxes.  Wouldn't that be logical?
Maybe not.  I was also hoping there was a system function I could all to
retrieve the current default dialog font.

Quote:

>You can use YourRadioButtonControl->SetFont( font, REDRAW ). You might have
>to hunt around in Character Map to identify which font is used by the
dialog
>editor.
>HTH



Sun, 25 Nov 2001 03:00:00 GMT  
 Different Font when creating buttons dynamically
Search for SystemParametersInfo( SPI_GETNONCLIENTMETRICS, ... )

Adeluc

DecoTech Design Software Inc.
Internet: http://www.pulsarsoft.com


Quote:
> I tried to use SetFont within the CButton class but it didn't seem to
work.
> I haven't dug into it too deeply, yet.  I'll do that tomorrow.  I guess it
> just seems strange to me that there isn't a simply way to make all
controls
> use the same font as is used in the dialog boxes.  Wouldn't that be
logical?
> Maybe not.  I was also hoping there was a system function I could all to
> retrieve the current default dialog font.


> >You can use YourRadioButtonControl->SetFont( font, REDRAW ). You might
have
> >to hunt around in Character Map to identify which font is used by the
> dialog
> >editor.
> >HTH



Mon, 26 Nov 2001 03:00:00 GMT  
 Different Font when creating buttons dynamically
Have you tried this:

BOOL
CMyDialog::OnInitDialog()
{
    CFont* pFont = GetFont();
    ... // code to create a CButton called m_btn
    m_btn.SetFont(pFont);

Quote:
}



Quote:
> Search for SystemParametersInfo( SPI_GETNONCLIENTMETRICS, ... )

> Adeluc

> DecoTech Design Software Inc.
> Internet: http://www.pulsarsoft.com



> > I tried to use SetFont within the CButton class but it didn't seem to
> work.
> > I haven't dug into it too deeply, yet.  I'll do that tomorrow.  I guess
it
> > just seems strange to me that there isn't a simply way to make all
> controls
> > use the same font as is used in the dialog boxes.  Wouldn't that be
> logical?
> > Maybe not.  I was also hoping there was a system function I could all to
> > retrieve the current default dialog font.


> > >You can use YourRadioButtonControl->SetFont( font, REDRAW ). You might
> have
> > >to hunt around in Character Map to identify which font is used by the
> > dialog
> > >editor.
> > >HTH



Mon, 26 Nov 2001 03:00:00 GMT  
 Different Font when creating buttons dynamically
That worked great, thanks!.  Seems pretty obvious now that I think about it.

Quote:

>Have you tried this:

>BOOL
>CMyDialog::OnInitDialog()
>{
>    CFont* pFont = GetFont();
>    ... // code to create a CButton called m_btn
>    m_btn.SetFont(pFont);
>}



>> Search for SystemParametersInfo( SPI_GETNONCLIENTMETRICS, ... )

>> Adeluc

>> DecoTech Design Software Inc.
>> Internet: http://www.pulsarsoft.com



>> > I tried to use SetFont within the CButton class but it didn't seem to
>> work.
>> > I haven't dug into it too deeply, yet.  I'll do that tomorrow.  I guess
>it
>> > just seems strange to me that there isn't a simply way to make all
>> controls
>> > use the same font as is used in the dialog boxes.  Wouldn't that be
>> logical?
>> > Maybe not.  I was also hoping there was a system function I could all
to
>> > retrieve the current default dialog font.


>> > >You can use YourRadioButtonControl->SetFont( font, REDRAW ). You might
>> have
>> > >to hunt around in Character Map to identify which font is used by the
>> > dialog
>> > >editor.
>> > >HTH



Mon, 26 Nov 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Different Font when creating buttons dynamically

2. Dynamically Created Buttons and their Fonts

3. Different fonts on different toolbar buttons

4. Font in a dynamically created CStatic control

5. Setting the font in dynamically created dialog app controls

6. Font in dynamically create CTabCtrl.

7. How to Create Fonts for different Languages

8. How to create different font for ClistCtrl

9. Dynamically creating buttons and firing events

10. URGENT - Dynamically creating radio buttons in Visual C++ 6.0 (MFC)

11. Dynamically Created Checkbox Button Does Not Appear on Dialog

12. Problems with default button on a dynamically created dialog

 

 
Powered by phpBB® Forum Software