C#ToolStrip的是透明的,但边框仍然可见? [英] C# ToolStrip is transparent but border is still visible?

查看:1983
本文介绍了C#ToolStrip的是透明的,但边框仍然可见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆