how to exclude control from a WinForm.Opacity in C#

后端 未结 2 1409
谎友^
谎友^ 2021-01-20 07:48

I have a form that i set it\'s Opacity as 50% like this:

this.Opacity = 0.5D; <--this==Form

My problem is that everything that on the fo

2条回答
  •  隐瞒了意图╮
    2021-01-20 08:24

    Crate a C# project and add 3 forms named

    1. MAIN
    2. BACKGOUND
    3. Child

    and add the following code for "MAIN" form load event;

    private void MAIN_Load(object sender, EventArgs e)
    {
         Child frm1 = new  Child();
         BACKGOUND frm2 = new BACKGOUND();
         frm2 .WindowState = System.Windows.Forms.FormWindowState.Maximized;      
    
         frm2.Opacity = 0.5;
         frm2.Show();
    
         frm1.ShowDialog();
         frm2.Close();
    }
    

提交回复
热议问题