Print Page | Close Window

Main menu in different fonts

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=3630
Printed Date: 19 July 2025 at 4:12am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Main menu in different fonts
Posted By: kanitamildasan
Subject: Main menu in different fonts
Date Posted: 09 February 2006 at 12:39am

Hi,

I have an application which toggle the main menu strings between two different languages at runtime

when menu is in 'non-english' font the last main menu item caption
should be in English font with string "English" and vice-versa

in the event handler of the last menu item i have changed the entire menubar font by using

CMenu cmenu;

...
...
 
CXTPMenuBar* pMenuBar = pCommandBars->GetMenuBar();

pMenuBar->LoadMenu(&cmenu);

...
...

XTPPaintManager()->SetCommandBarsFontIndirect(&lf);&a mp;a mp;a mp;a mp;n bsp; 

XTPPaintManager()->RefreshMetrics();

but how can i change only the last menu item caption to a different font ?

thanks in advance



-------------
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2
Visual C++ 6.0 SP 6



Replies:
Posted By: kanitamildasan
Date Posted: 12 February 2006 at 10:35pm

hi,

Do i need to derive from CXTPMenuBar and override the OnPaint to change the font when last Button is going to drawn on the screen ?



Posted By: kanitamildasan
Date Posted: 15 February 2006 at 5:44am

hi,

anyone ?



Posted By: Oleg
Date Posted: 15 February 2006 at 7:51am

Hello,

Here sample:

 

class CXTPOffice2003ThemeEx : public CXTPOffice2003Theme
{
public:
    CXTPOffice2003ThemeEx()
    {
       
    }

    void RefreshMetrics()
    {
        CXTPOffice2003Theme::RefreshMetrics();

        LOGFONT lf;
        m_fontRegular.GetLogFont(&lf);

        m_fontItalic.DeleteObject();
        m_fontUnderline.DeleteObject();

        lf.lfItalic = 1;
        m_fontItalic.CreateFontIndirect(&lf);

        lf.lfItalic = 0;
        lf.lfUnderline = 1;
        m_fontUnderline.CreateFontIndirect(&lf);
    }


    CSize DrawControlPopupParent(CDC* pDC, CXTPControl* pButton, BOOL bDraw)
    {
        if (pButton->GetID() == ID_LANGUAGE_ENGILISH)
        {
             CXTPFontDC font(pDC, &m_fontItalic);
             return CXTPOffice2003Theme::DrawControlPopupParent(pDC, pButton, bDraw);
        }

        if (pButton->GetID() == ID_LANGUAGE_FRANCH)
        {
             CXTPFontDC font(pDC, &m_fontUnderline);
             return CXTPOffice2003Theme::DrawControlPopupParent(pDC, pButton, bDraw);
        }

        return CXTPOffice2003Theme::DrawControlPopupParent(pDC, pButton, bDraw);

    }

protected:
    CFont m_fontItalic;
    CFont m_fontUnderline;
};

 

 

usage:

CXTPPaintManager::SetCustomTheme(new CXTPOffice2003ThemeEx);

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: kanitamildasan
Date Posted: 16 February 2006 at 6:10am

Hi,

[- Hearty Thanks -] 

I got what i need by overriding DrawControlToolbarParent()

If i allow my application user to change the themes on the fly like Customthemes  sample

the only way is to derive and override DrawControlToolbarParent() for all themes (ex CXTPOffice2003Theme,CXTPWhidbeyTheme etc) ?

 

 

 

 



-------------
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2
Visual C++ 6.0 SP 6



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net