How to create Transparent panel in c#.Net

风格不统一 提交于 2019-12-08 16:18:31

问题


I have a Panel on windows Form with few controls inside panel,

Can i make panel completely transparent.

(It should give the feel that controls are placed directly on Form)


回答1:


If you go to the BackColor property, and change the Selector to "Web" the first choice is Transparent (at least it is in my VB IDE). I believe that the BackColor of the Panel would inherit the color of the component it is on.




回答2:


I assume it is WinForms app.

Try this in Form.Load event:

    private void Form1_Load_1(object sender, EventArgs e)
    {
        panel1.BackColor = Color.FromArgb(0, 0, 0, 0);
    }

where panel1 is the panel you want to have transparent.

It will make the color transparent. You can have other controls on the panel.



来源:https://stackoverflow.com/questions/2722319/how-to-create-transparent-panel-in-c-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!