Notifications
Clear all

[Closed] ContextMenuStrip back color

I’m using ContextMenuStrip.
I have a nested menu.
ContextMenu backColor only change back color of the top menus.
I found Denis’s paint trick.
I could change color of nested menu back color.

BUT, I can not change the border(?) around menu.
Any ideas?

4 Replies

So… I guess I need to override color table of renderer.

https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-implement-a-custom-toolstriprenderer?redirectedfrom=MSDN

I have no idea how I would do in mxs…

so… further research shows I need to make a custom color table…

// This class defines the gradient colors for
// the MenuStrip and the ToolStrip.
class CustomProfessionalColors : ProfessionalColorTable
{
public override Color ToolStripGradientBegin
{ get { return Color.BlueViolet; } }

public override Color ToolStripGradientMiddle
{ get { return Color.CadetBlue; } }

public override Color ToolStripGradientEnd
{ get { return Color.CornflowerBlue; } }

public override Color MenuStripGradientBegin
{ get { return Color.Salmon; } }

public override Color MenuStripGradientEnd
{ get { return Color.OrangeRed; } }

}

https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-set-the-toolstrip-renderer-at-run-time

This does not seem to be what you need. Can you show an image of what you want to draw on your own and how it should look like?