Reduce the space between the menu item icon and its text

In my .net windows form (I use XP Pro SP3 and VS 2010), I created menustrip. Menustrip has several menu items, each of which has a drop-down menu. Menu items in the drop-down menus have an icon with some text. I want to make the menu more compact by reducing the horizontal space between the icon and the text. (I added a red arrow to the image to show the space I'm talking about).

enter image description here

So far, I have set all menu items to 0, but this only affects the vertical distance between one menu item and the next.

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

It's funny that this very interval is exactly what I want in menustrip - the icon is next to the text.

This will completely remove the image fields, but also delete the images; I just want to change the image field width.

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

What can i do here?

+6
source share
1 answer

So, this is a kind of fraud and probably will not look as clean as you would like, but I was able to do this by making the image have text and then setting the following properties in the constructor for the menu item:

DisplayStyle = Image

ImageScaling = None

enter image description here

+2
source

Source: https://habr.com/ru/post/907979/


All Articles