We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the CustomTextFont property of the Popup menu items which gets shown when right click on toolbar area?

Platform: WinForms |
Control: XPToolbar |
Published Date: April 30, 2011 |
Last Revised Date: July 10, 2014

 

The text font in the context menu can be changed by getting the CommandBar using GetCommandBarManager method and get hold of DockBarContextMenu. Now the ParentBarItem's BeforePopup event has to handled to change the text font of Popup menu items. Please refer the below code snippet which illustrates this:

C#

this.mainFrameBarManager1.GetCommandBarManager().DockBarContextMenu.ParentBarItem.BeforePopup+=new CancelEventHandler(ParentBarItem_BeforePopup);

private void ParentBarItem_BeforePopup(object sender, CancelEventArgs e)

{

foreach(BarItem baritem in this.mainFrameBarManager1.GetCommandBarManager().DockBarContextMenu.ParentBarItem.Items)

{

baritem.CustomTextFont=new Font("Times New Roman",8.25F);

}

}

VB

AddHandler mainFrameBarManager1.GetCommandBarManager().DockBarContextMenu.ParentBarItem.BeforePopup, AddressOf ParentBarItem_BeforePopup

Private Sub ParentBarItem_BeforePopup(ByVal sender As Object, ByVal e As CancelEventArgs)

For Each baritem As BarItem In Me.mainFrameBarManager1.GetCommandBarManager().DockBarContextMenu.ParentBarItem.Items

baritem.CustomTextFont = New Font("Times New Roman",8.25F)

Next baritem

End Sub

Sample:

http://websamples.syncfusion.com/samples/KB/Tools.Windows/TFont/main.htm

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon