Domanda

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?

È stato utile?

Soluzione

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!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top