blog

I like to blog about current software design and development projects, as well as general everyday news and events. I'm passionate about what I do and you can follow my personal journey through my blog. I'm constantly on the lookout for new development techniques and technologies to keep on top of the changing market, so if I do miss anything feel free to leave me a comment.

Posts Tagged ‘ToolStrip’

Removing white border on a ToolStrip

Sunday, March 8th, 2009

If you have ever used the ToolStrip control and changed its background colour, you will have noticed that it has a white border around it as show in the picture. This problem can be overcome with a simple override.

Create a new file ToolStripOverride.cs and copy the following code.

1
2
3
4
5
6
7
8
9
10
11
using System.Windows.Forms;
 
namespace OverrideControls
{
    public class ToolStripOverride : ToolStripProfessionalRenderer
    {
        public ToolStripOverride() { }
 
        protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { }
    }
}

Then inside the class where you have your ToolStrip control add the following line to the constructor.

1
myToolStripControl.Renderer = new ToolStripOverride();