C
C#12mo ago
Vera

❔ How do I remove white line on the left side of a ToolStripMenuItem in windows forms

I have already removed the image margin using this function I found on stackoverflow
private static void SetValuesOnSubItems(List<ToolStripMenuItem> items)
{
items.ForEach(item =>
{
var dropdown = (ToolStripDropDownMenu)item.DropDown;

if (dropdown != null)
{
dropdown.ShowImageMargin = false;

SetValuesOnSubItems(item.DropDownItems.OfType<ToolStripMenuItem>().ToList());
}
});
}
private static void SetValuesOnSubItems(List<ToolStripMenuItem> items)
{
items.ForEach(item =>
{
var dropdown = (ToolStripDropDownMenu)item.DropDown;

if (dropdown != null)
{
dropdown.ShowImageMargin = false;

SetValuesOnSubItems(item.DropDownItems.OfType<ToolStripMenuItem>().ToList());
}
});
}
However, this still leaves the white line on the left which I am looking to remove but I am unsure as to how to
8 Replies
stigzler
stigzler12mo ago
Are you trying to theme winforms ToolStrips?
Vera
Vera12mo ago
Yeah, I've just figured it out now though by making a new ToolStripProfessionalRenderer with a class which overrides ImageMarginGradientBegin, ImageMarginGradientMiddle and ImageMarginGradientEnd
stigzler
stigzler12mo ago
Trying to make a dark-mode? + that's deffo the right track
Vera
Vera12mo ago
Yeah Trying to make the context menu a dark ish theme I'm going to make a color pallet and go through the original ProfessionalColors class and just replace individual colors
stigzler
stigzler12mo ago
Gist
DarkToolStripRenderer
DarkToolStripRenderer. GitHub Gist: instantly share code, notes, and snippets.
Vera
Vera12mo ago
I'll take a look at it, appreciate it
stigzler
stigzler12mo ago
👍
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts