How to change the Font of CXTPControl ? |
Post Reply |
Author | |
kanitamildasan
Senior Member Joined: 01 February 2006 Status: Offline Points: 102 |
Post Options
Thanks(0)
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. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
No :( You can only make font bold (SetItemDefault(TRUE)) or use Markup feature.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
kanitamildasan
Senior Member Joined: 01 February 2006 Status: Offline Points: 102 |
Post Options
Thanks(0)
|
Hi Oleg,
I am kind of new to Markups. An example for this Scenario will be more helpful. Thanks |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Here sample:
CXTPControlMarkupLabel* pLabel = new CXTPControlMarkupLabel();
pMenuBar->GetControls()->Add(pLabel);
pLabel->SetCaption(_T("<TextBlock TextAlignment='Center'><Underline>This is</Underline><LineBreak/><Bold>Markup</Bold> <Run Foreground='Red'>Label</Run><LineBreak/><Italic>Control</Italic></TextBlock>")); |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
kanitamildasan
Senior Member Joined: 01 February 2006 Status: Offline Points: 102 |
Post Options
Thanks(0)
|
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. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
kanitamildasan
Senior Member Joined: 01 February 2006 Status: Offline Points: 102 |
Post Options
Thanks(0)
|
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 :) |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |