Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Main menu in different fonts
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Main menu in different fonts

 Post Reply Post Reply
Author
Message
kanitamildasan View Drop Down
Senior Member
Senior Member
Avatar

Joined: 01 February 2006
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote kanitamildasan Quote  Post ReplyReply Direct Link To This Post Topic: Main menu in different fonts
    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
Back to Top
kanitamildasan View Drop Down
Senior Member
Senior Member
Avatar

Joined: 01 February 2006
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote kanitamildasan Quote  Post ReplyReply Direct Link To This Post 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 ?

Back to Top
kanitamildasan View Drop Down
Senior Member
Senior Member
Avatar

Joined: 01 February 2006
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote kanitamildasan Quote  Post ReplyReply Direct Link To This Post Posted: 15 February 2006 at 5:44am

hi,

anyone ?

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
kanitamildasan View Drop Down
Senior Member
Senior Member
Avatar

Joined: 01 February 2006
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote kanitamildasan Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.046 seconds.