问题
I have two Windows Forms toolstrips that contain some controls on a form. However, for some strange reason, they contain a vertical line on the right hand side. I cannot find any property to remove them and I cannot find any other information on how to get rid of them online.
Can anyone help? Thanks in advance.
回答1:
It's the border of the toolstrip. Meant to give a clear separation between multiple adjacent tool strips. Changing its RenderMode property to System would be one way to get rid of it, albeit that this changes the look-and-feel. Or you can write your own renderer to get rid of it. A C# example:
public Form1() {
InitializeComponent();
toolStrip1.Renderer = new MyRenderer();
}
private class MyRenderer : ToolStripProfessionalRenderer {
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) {
// Do nothing
}
}
来源:https://stackoverflow.com/questions/11885780/why-am-i-getting-a-vertical-line-on-toolstrip