question

nachoshaw-9496 avatar image
0 Votes"
nachoshaw-9496 asked DanielZhang-MSFT answered

Transparency on a usercontrol

Hi

I am able to create a transparent panel easily enough on a top level windows form. I read that this is only works on a top level window... I am using some UserControls as overlay dialogs to process some settings. How would go about creating a transparent panel on a sub level UserControl?

MyPanel1.BackColor = Color.FromArgb)25, 100, 100, 100)

works for the top level form but not the sub level UserControl

Thanks

windows-forms
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DanielZhang-MSFT avatar image
0 Votes"
DanielZhang-MSFT answered

Hi NachoShaw-9496,
First, I add User Control(UserControl1) in project.(Right click project name ->Add->User Control)
Then drag panel control form ToolBox to UserControl1 in UserControl1.cs[Design] window.
And using your code as follows:

 private void UserControl1_Load(object sender, EventArgs e)
 {
    
     panel1.BackColor = Color.FromArgb(25, 100, 100, 100);
 }

It worked fine.
So do you want to create a transparent panel or a transparent usercontrol?
And what does top/ sub level mean in your description?
Where is your usercontrol?
Please provide more details to reproduce the situation.
Best Regards,
Daniel Zhang


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.