C#ToolStrip的是透明的,但边框仍然可见? [英] C# ToolStrip is transparent but border is still visible?
问题描述
我有一个ToolStrip的在我设置背景颜色为透明C#应用程序。这揭示了潜在的窗体的颜色,但不幸的是,ToolStrip的边框仍然可见。
我已经实现了一个自定义呈现,并覆盖了DrawBoarder方法不画任何东西,但似乎适用于所有的包含按钮以及(即还绘制没有边框的下拉按钮,在菜单中)。
所以,我坚持。什么是绘制透明的整个ToolStrip的,但先不谈按钮的最佳方法是什么?
保护覆盖无效OnRenderToolStripBorder(ToolStri prenderEventArgs E)
{
如果(e.ToolStrip.GetType()。名称!=MyCustomToolStrip)
{
base.OnRenderToolStripBorder(E);
}
}
I have a ToolStrip in a C# application that I set the background color to Transparent. This reveals the underlying form's color but unfortunately the ToolStrip border is still visible.
I've implemented a Custom Renderer and overridden the DrawBoarder method to not draw anything but that seems to apply to all of the contained buttons as well (i.e the menu on drop down buttons are also drawn without a border).
So I'm stuck. What's the best way to draw transparent the entire ToolStrip but leave the buttons alone?
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
{
if( e.ToolStrip.GetType().Name != "MyCustomToolStrip" )
{
base.OnRenderToolStripBorder(e);
}
}
这篇关于C#ToolStrip的是透明的,但边框仍然可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!