Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Bold text on a CExtButton? Collapse All
Subject Author Date
Cyndi Chatman Feb 8, 2007 - 6:31 AM

When using a theme, can i make the text bold on buttons to make them stand out more?

Cyndi Chatman Feb 8, 2007 - 2:08 PM

Hi - I tried to do this, but my OnQueryFont() handler is not being called?? Here is my code:

In Header File:

class CBoldExtButton : public CExtButton
{    
public:
    DECLARE_DYNAMIC( CBoldExtButton );
    CBoldExtButton();
    ~CBoldExtButton();
    
protected:
    virtual HFONT OnQueryFont();
}; // class CBoldExtButton

In CPP File:

IMPLEMENT_DYNAMIC( CBoldExtButton, CExtButton );

CBoldExtButton::CBoldExtButton()
{
}

CBoldExtButton::~CBoldExtButton()
{
}

HFONT CBoldExtButton::OnQueryFont()
{
    ASSERT_VALID(this);
    return g_PaintManager->m_FontBold;
}

I have a breakpoint in the OnQueryFont() handler and I am not hitting it.

Technical Support Feb 9, 2007 - 12:37 PM

In your code, please replace

virtual HFONT OnQueryFont();
with
virtual HFONT OnQueryFont() const;


Technical Support Feb 8, 2007 - 9:08 AM

You can make the button’s text bold by overriding the CExtButton::OnQueryFont() method, which returns a handle to the font used for drawing the text. You can get the bold font using g_PaintManager->m_FontBold.