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. Image for the cookie policy date
close icon

How to increase the size of bar items in main menu?

Is it possible to adjust (increase) the size of menu items when I use icons larger than 16px? I can set larger icons but the height of items doesn't change. To be precise I mean BarItems which are added to ParentBarItem, which in turn is added to XPMenus.Bar created with MainFrameBarManager. Thanks. 

3 Replies

VI Vinothini Syncfusion Team March 2, 2015 06:28 AM UTC

Hi Sergei,

Thank you for using Syncfusion products.

At present there is no option to customize the image size in ChildBarItem and ChildBarItem size will be defined based on its font size. So we suggest you to make use of CustomFontText property in BarItem, to customize its size. Please have the code snippet below which demonstrate the same.

Code Snippet [C#]:

// Font Size

this.barItem1.CustomTextFont = new System.Drawing.Font("Microsoft Sans Serif", 25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

//Image size

this.barItem1.ImageSize = new System.Drawing.Size(50, 40);

We have also prepared sample and image for your reference and it can be downloaded from the following location.

Image Location: http://www.syncfusion.com/uploads/user/directTrac/118336/baritem-1282466376.zip

Sample Location : http://www.syncfusion.com/uploads/user/directTrac/118336/BarItem974254172.zip​ 

Note : The default BarItem image size can be customized using ImageSize property.

Please let us know if it helps,

Regards,

Vinothini.R




SL Sergei Leschinksy March 2, 2015 09:04 AM UTC

Thanks for the answer. Custom font increases the size of items indeed. Although I'm not sure that it looks particularly good. Most likely I'd choose either to limit myself to small icons or use regular MenuStrip embedded in detached CommandBar instead. Would be great, guys, if you add this functionality, i.e. calculate the size of menu items depending on both font and icon size + some customizable padding. I guess having 24 px icons in menus without scaling the font isn't too unreasonable demand.

Best regards,
Sergei


AJ Ashwini Jaya Preetha Durai Samy Syncfusion Team March 3, 2015 04:45 PM UTC

Hi Sergei,

 

Thank you for your update.

 

As per the implementation of child BarItem, its bounds calculation will be done based on its font size. Hence we have suggested you the same. We request you to use this approach, to achieve this reported behavior.

 

Please let us know if you need any further assistance,

 

Regards,

Ashwini


Loader.
Live Chat Icon For mobile
Up arrow icon