Click here to Skip to main content
15,791,567 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
there is a margin in the of all the items. How can I remove it?
The controls is System.Windows.Forms.ToolStripDropDownButton and System.Windows.Forms.StatusStrip

What I have tried:

I searched it, but there's no particular good solution.
Updated 8-Feb-23 13:28pm
CHill60 8-Feb-23 9:08am    
You'll need to provide more detail than this! Which Toolstripdropdown for starters and a bit of a better description of the problem.
DeTK 8-Feb-23 9:10am    
I want to upload an image, but how do I put it in the question...
Richard Deeming 8-Feb-23 9:43am    
You can't upload an image. Apart from the fact that the site would quickly be swamped with inappropriate images, far too many people would just post images of their code and error messages, rather than copying the text into their questions.
DeTK 8-Feb-23 9:45am    
It's sad...
Richard Deeming 8-Feb-23 9:47am    
But nobody else can.

For example, how is a screenshot going to answer CHill60's first question: which ToolStripDropDown are you using? We can't tell just by looking at a screenshot of your application.

1 solution

Not sure why I made the effort, this will help you on your problem. Please give us more information next time as it makes it easier to understand your question -

You have to use "ToolStripDropDownMenu" this way -
((ToolStripDropDownMenu)noMargins.DropDown).ShowImageMargin = false;

For example, if you want to remove all image margins from your menubar called "menuStrip1", add this code to your form initialization routine -
// Removing image margins (space for icons on left) from menubar items:
foreach (ToolStripMenuItem menuItem in menuStrip1.Items)
    ((ToolStripDropDownMenu)menuItem.DropDown).ShowImageMargin = false;
Share this answer
DeTK 8-Feb-23 10:11am    
I didn't know how to use it, but when I saw it again, I understood. That was not a question to ask. I think I saw this answer in the stack overflow.
I didn't know that noMargins is toolStripDropDownButton...
Next time, I'll think about it more and write down all the information I need for the question.
Andre Oosthuizen 9-Feb-23 1:37am    
Thank you and it was a pleasure.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900