Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - How to change the Font of CXTPControl ?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to change the Font of CXTPControl ?

 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: How to change the Font of CXTPControl ?
    Posted: 27 February 2009 at 1:16am
Hi,

    CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_SAMPLETYPE);

    if(pMenuBar == NULL)
    {
        TRACE0("Failed to create menu bar.\n");
        return -1;      // fail to create
    }

    pMenuBar->SetFlags(xtpFlagAddMDISysPopup);   

    int NoOfCtrls = -1;
    NoOfCtrls = pMenuBar->GetControlCount();
    CXTPControl *pControl = NULL;
    pControl = pMenuBar->GetControl(NoOfCtrls - 1);

Is it possible to change the Font of pControl here ? (only pControl not entire CommandBars through XTPPaintManager)

Thanks in advance.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 27 February 2009 at 2:59am
Hi,
No :( You can only make font bold (SetItemDefault(TRUE))  or use Markup feature.
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: 27 February 2009 at 7:48am
Hi Oleg,

I am kind of new to Markups. An example for this Scenario will be more helpful.

Thanks

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 02 March 2009 at 12:41am
Hi,
 
Here sample:
 
CXTPControlMarkupLabel* pLabel = new CXTPControlMarkupLabel();
 pLabel->SetCaption(_T("<TextBlock TextAlignment='Center'><Underline>This is</Underline><LineBreak/><Bold>Markup</Bold> <Run Foreground='Red'>Label</Run><LineBreak/><Italic>Control</Italic></TextBlock>"));
pMenuBar->GetControls()->Add(pLabel);
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: 03 March 2009 at 4:47am
Thanks oleg,

It changes the font correctly. Being a Label it does not work like a button(which i need like handle Click event,mouse over highlight etc).
And when i dock the menu bar to right or left of the Mainframe the label didnt render the vertical text.


Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 03 March 2009 at 5:18am
Hi,
 
Yes, both true.
 
 
Another option is to create class derived from some CXTPOfficeTheme, override GetControlFont and return font you need.
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: 05 March 2009 at 11:37pm
Thanks Oleg,

Deriving from CXTPOfficeTheme works only for it. so i found some workaround to make it work for all the themes using some macros :)



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.141 seconds.