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 Tech Support » Hot to make CExtLabel display bold font Collapse All
Subject Author Date
delu qiu May 15, 2006 - 3:12 PM

Hi,

I place serveral CExtLabel in my dialog, and I setfont for the CExtLabel like below:

---------------------------------------
class CSPSSelection:public CExtNCW < CExtResizableDialog>
....


    LOGFONT lf;
    CFont *pFont;
    memset(&lf, 0, sizeof(LOGFONT));
    lf.lfHeight = 20;
    lf.lfWeight = 700;                        
    lf.lfCharSet = DEFAULT_CHARSET;
    strcpy(lf.lfFaceName, "Arial");            
    pFont = CFont::FromHandle(CreateFontIndirect(&lf));
    m_staticBig.SetFont (pFont, false);
-------------------------------------------------------
but m_staticBig display normal size, What is the way to make it bold?

Thanks

Technical Support May 16, 2006 - 9:43 AM

There is a bug in the CExtLabel class that causes the problem. Please find the CExtLabel::OnDrawLabelText() method and replace the following line:

lf.lfWeight = m_bFontBold ? FW_BOLD : FW_NORMAL;
with this
if( m_bFontBold )

            lf.lfWeight = 

                        (lf.lfWeight > FW_BOLD) 

                                    ? lf.lfWeight 

                                    : FW_BOLD;
Now you can set a custom font and the weight attribute will not be reset to FW_NORMAL.

Technical Support May 16, 2006 - 6:42 AM

First, you need to set a negative value for the lfHeight attribute:

lf.lfHeight = -20;
Second, if you just need to make the static bold, you can use the CExtLabel::SetFontBold() method.



delu qiu May 16, 2006 - 8:47 AM

Thank you, It’s works.

By the way, where I can found the help document of SetFontBold?
I can’t find it in Prof-UIS Help.


Thanks.

Technical Support May 16, 2006 - 10:11 AM

This method was added recently and it is not yet included in the documentation. The updated documentation will be available soon.