-1

So I have a multiple forms and one main form. I show the child forms through a panel. I was wondering if I could make the child forms transparent, that way it would blend in with my background image. Thank you!

lavinge
  • 3
  • 2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jun 01 '22 at 10:47

1 Answers1

0

Prepare your form and panel

Set your panel

// 
// panel1
// 
this.panel1.BackColor = System.Drawing.SystemColors.ControlDark;

And your form

// 
// Form1
//
this.BackColor = System.Drawing.SystemColors.ControlDark;
this.TransparencyKey = System.Drawing.SystemColors.Control;

Now add child forms

Form form = new Form()
{
    TopLevel = false
};
panel1.Controls.Add(form);
form.Show();

Read also

And remember, if you set red color to TransparencyKey and BackColor of your form and controls then they will be able to handle mouse events. This is only in case of red color. In other cases Any mouse actions, such as the click of the mouse, that are performed on the transparent areas of the form will be transferred to the windows below the transparent area. For example, if the client region of a form is made transparent, clicking the mouse on that area would send the event notification of the click to any window that is below it. See this and this.

DotNet Developer
  • 2,973
  • 1
  • 15
  • 24