我使用ToolStripDropDownButton,Forecolor是white,Backcolor是trasparent。当鼠标在控件上方时,“ToolStripDropDownButton”的文本不可读,因为“蓝色焦点”可见。
当鼠标在控件上方时,如何消除/移除ToolStripDropDownButton上的“蓝色焦点” ?如下图所示。谢谢你。
这会产生像 digEmAll 图片这样的输出。
using System;
using System.Windows.Forms;
using System.Drawing;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
toolStrip1.BackColor = Color.Transparent;
toolStrip1.GripStyle = ToolStripGripStyle.Visible;
toolStrip1.Renderer = new MyRenderer();
}
private class MyRenderer : ToolStripSystemRenderer
{
protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
{
e.ArrowColor = Color.White;
base.OnRenderArrow(e);
}
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
{
// remove white line bellow button (http://connect.microsoft.com/VisualStudio/feedback/details/92862/toolstrip-always-draws-a-border-on-the-bottom-with-rendermode-system-and-docked-left-or-right)
//base.OnRenderToolStripBorder(e);
}
}
}
}