I have my ToolStripMenuItem
and when I run the application, it looks like this:
As you can see, there is a little white space at the ToolStripMenuItem
left.
How can I remove it? I tried to edit every property but it still remains...
Thank you all in advance!
To change appearance of menu item you should use a ToolStripProfessionalRenderer
using a custom ProfessionalColorTable
.
To change that color, you should override ImageMarginGradientBegin
property of custom color table and return the color you want.
For example you can have :
public class CustomColorTable : ProfessionalColorTable
{
public override Color ImageMarginGradientBegin
{
get { return Color.Red; }
}
public override Color ImageMarginGradientMiddle
{
get { return Color.Green; }
}
public override Color ImageMarginGradientEnd
{
get { return Color.Blue; }
}
public override Color ToolStripDropDownBackground
{
get { return Color.Yellow; }
}
public override Color MenuItemSelected
{
get { return Color.Pink; }
}
//You should also override other properties if you need.
//This is just a sample code to show you the solution
}
And then in your form load:
private void Form_Load(object sender, EventArgs e)
{
ToolStripManager.Renderer = new ToolStripProfessionalRenderer(new CustomColorTable());
}