C#ToolStrip的是透明的,但边框仍然可见?的是、边框、透明、ToolStrip

2023-09-05 01:49:26 作者:夜色有点甜

我有一个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.

QQ前两天弄了个透明皮肤,但是QQ的登陆会话框也变成全黑色的了,怎么回事 有办法吗

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);
    }
}