Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to set a panel's opacity to the other controls of the form in c# Win. form?
Posted

1 solution

C#
public partial class Form1 : Form 
{
    public Form1() 
{
        InitializeComponent();
        this.BackColor = Color.White;
        panel1.BackColor = Color.FromArgb(25, Color.Black);
    }
}


See full answer here[^].

-KR
 
Share this answer
 
v2
Comments
agent_kruger 25-Mar-14 3:51am    
sir, actually by seeing the code it looks like you are drawing a rectangle with "PEN" but how does it change the opacity let's say "50%".
Krunal Rohit 25-Mar-14 9:38am    
Answer is updated...

-KR
agent_kruger 27-Mar-14 5:36am    
but actually it turn the back color of panel to gray and still keeping it opaque.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900