使用toolstrip时,将BackColor设置为Transparent时会出现右边的黑竖线,先将RenderMode设置为System,又会出现下面的白边,因为无法通过基本的设置属性除去,只需要重绘一下toolstrip即可,C#源代码如下://toolstrip重绘 private void toolStrip1_Paint(object sender, PaintEventArgs e) { if ((sender as ToolStrip).RenderMode == ToolStripRenderMode.System) { Rectangle rect = new Rectangle(0, 0, this.toolStrip1.Width-2, this.toolStrip1.Height-2); e.Graphics.SetClip(rect); } } 右键点击toolstrip1控件 选中属性最上方的event 把toolstrip的重绘事件为这个就OK了(将控件的Paint事件选择toolStrip1_Paint)

爱华网本文地址 » http://www.aihuau.com/a/25101016/293089.html