3

I coulnd find a proper name and phrase for this to explain, so here's a picture:

enter image description here

I'd like to change the white area's as shown above in the red circle to a desired color. I used the code below to change the other colors:

In the form itself:

menuStrip1.Renderer = new ToolStripProfessionalRenderer(new MenuStripColorTable());

The class:

class MenuStripColorTable : ProfessionalColorTable
{
    private Color backColor = (Color) new ColorConverter().ConvertFromString("#333333");

    //menu item background en border
    public override Color MenuItemBorder
    {  
        get{ return Color.White; }
    }

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

Any idea what I should override, or change?

Grant Winney
  • 65,241
  • 13
  • 115
  • 165
Nick Peelman
  • 585
  • 1
  • 10
  • 28
  • this is part o the menu item. it's the location of the picture box for the icon. hope this help you find it. in WPF it's part of the menu item too. – Franck Dec 17 '13 at 12:49
  • Aha, I overrided the Image Gradiant properties to transparant, and that did the job. Thanks! – Nick Peelman Dec 17 '13 at 12:58

1 Answers1

3

By adding the folowing code I succesfully made teh white squares transparant:

Render class for menustrip:

public override Color ImageMarginGradientBegin
{
   get { return Color.Transparent; }
}
public override Color ImageMarginGradientMiddle
{
   get { return Color.Transparent; }
}
public override Color ImageMarginGradientEnd
{
   get { return Color.Transparent; }
}

Altho the text isn't aligned to the left. But that's not that much of a problem. Credit to Franck aswell!

King King
  • 61,710
  • 16
  • 105
  • 130
Nick Peelman
  • 585
  • 1
  • 10
  • 28