Transparency on a usercontrol

NachitoMax 416 Reputation points
2021-01-06T19:29:42.97+00:00

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

Developer technologies | Windows Forms
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Daniel Zhang-MSFT 9,656 Reputation points
    2021-01-07T05:14:29.373+00:00

    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.