C# ToolStrip is transparent but border is still visible?

后端 未结 3 1546
孤城傲影
孤城傲影 2021-01-19 19:41

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 s

相关标签:
3条回答
  • 2021-01-19 20:19

    Since you are trying to make the toolstrip hidden but keep the buttons, I have to put this out there.

    Do you even need the toolstrip?

    It might be better if you just used buttons in the application without the seemingly unneeded toolstrip.

    0 讨论(0)
  • 2021-01-19 20:31
    protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
    {
        if( e.ToolStrip.GetType().Name != "MyCustomToolStrip" )
        {
            base.OnRenderToolStripBorder(e);
        }
    }
    
    0 讨论(0)
  • 2021-01-19 20:33

    I have tried just overriding the OnRenderToolStripBorder method and it seems it doesn't affect the buttons at all. Have you tried it like this?

    public class TestStripRenderer : ToolStripProfessionalRenderer
    {   
        protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
        {
        }
    }
    
    0 讨论(0)
提交回复
热议问题