semi-transparent form but opaque Controls in C#

后端 未结 3 516
無奈伤痛
無奈伤痛 2020-12-16 22:09

How to make semi transparent form in C# windows form application

I have tried the TransparentKey which makes it full-transparent. and tried Opacit

3条回答
  •  死守一世寂寞
    2020-12-16 22:39

    There is a solution which add semi-transparency to a Control (not Form) :

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
    
            // Apply opacity (0 to 255)
            panel1.BackColor = Color.FromArgb(25, panel1.BackColor);
        }
    

    In visual Studio : (alpha activated only during execution)

    Executed on Windows 7 :

    Executed on an old WIndows 2003 Server :

    Source : https://stackoverflow.com/a/4464161/1529139

提交回复
热议问题