Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can i set opacity of pannel, like for form there is opacity property.
Posted

1 solution

You can't set an opacity for a panel: it's a function of top level windows (such as forms) only - it is a hardware function that isn't enabled for child windows such as Panel.

You can - sort of - do it, by setting the panel background colour to an Alpha value of zero, but...it's not very good!
C#
public frmMain()
    {
    InitializeComponent();
    myPanel.BackColor = Color.FromArgb(0, Color.Black);
    }
protected override void OnPaint(PaintEventArgs e)
    {
    e.Graphics.DrawLine(Pens.Red, 0, 0, Width, Height);
    }
 
Share this answer
 
Comments
RhishikeshLathe 3-Feb-14 6:22am    
Thanks for ur reply, sir.
Very sad that we can't set an opacity for a panel.
I will blame it for microsoft,
microsoft is limiting our thinking box.

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