![]() |
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)
Quote Reply
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. |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
kanitamildasan
Senior Member
Joined: 01 February 2006 Status: Offline Points: 102 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 02 March 2009 at 12:41am |
|
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)
Quote Reply
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. |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
kanitamildasan
Senior Member
Joined: 01 February 2006 Status: Offline Points: 102 |
Post Options
Thanks(0)
Quote Reply
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 :) |
|
![]() |
|
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 |