Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decrease the Space Between a Menu Item's Icon and its Text

In my .net windows form (I am using XP Pro SP3 and VS 2010), I have created a menustrip. In the menustrip are several menu items, each with a dropdown menu. The menu items in the dropdown menus each have an icon with some text. I want to make the menu more compact by decreasing the horizontal space between the icon and the text. (I added a red arrow to the picture to show the space I am talking about).

enter image description here

So far, I have set the padding of all the menuitems to 0, but this seems only to affect the vertical spacing between one menu item and the next.

I want to use the system rendermode for the menustrip (although the problem persists no matter what rendermode I use. The icons in the menu are 16x16, and have the property sizetofit.

Funny thing is that this very same spacing is just the way I want it in the menustrip - the icon is right next to the text.

This will remove the image margin completely, but it removes the images too; I just want to change the width of the image margin.

    For Each menuItem As ToolStripMenuItem In menu_main.Items
        DirectCast(menuItem.DropDown, ToolStripDropDownMenu).ShowImageMargin = False
    Next

What can I do here?

like image 840
bgmCoder Avatar asked Feb 08 '12 19:02

bgmCoder


1 Answers

So, this is kinda cheating, and probably isn't going to look as clean as you'd like, but I was able to do it by making the image have the text and then setting following properties in the designer for the menu item:

DisplayStyle = Image

ImageScaling = None

enter image description here

like image 161
вʀaᴎᴅᴏƞ вєнᴎєƞ Avatar answered Nov 03 '22 23:11

вʀaᴎᴅᴏƞ вєнᴎєƞ