Search code examples
c#winformstoolstrip

ToolStripSplitButton splitter issue


I have a form with ToolStrip and I placed on it ToolStripSplitButton.

    toolStrip1.BackColor = Color.White;
    toolStrip1.GripStyle = ToolStripGripStyle.Hidden;

    splitButton.Image = PlusPic;
    splitButton.Size = new Size(30, 30);
    splitButton.Visible = true;
    toolStrip1.Items.Add(splitButton);

And it looks like this:

enter image description here

But for some reason I have to use custom renderer for ToolStrip.

class ToolstripCustomRenderer : ToolStripSystemRenderer { }

toolStrip1.Renderer = new ToolstripCustomRenderer();

And after I set Renderer it changed look of ToolStripSplitButton. It independs of which methods I override in ToolstripCustomRenderer. So my ToolStripSplitButton looks different:

enter image description here

And I want to get rid of splitter which appears. But I don't have a clue how to do this.


Solution

  • The answer is just to use ToolStripProfessionalRenderer as parent class for custom renderer. (Hans Passant)