I need to make transparent only the background, nothing more. I tried through the option "Opacity" but then everything becomes transparent, both the form and the buttons and everything else. Help please, it is advisable to submit a piece of code, otherwise I have recently appeared in C #.

  • WinForms or WPF? - Jakeroid
  • I use WinForms - MikroFF

2 answers 2

For WinForms:

this.FormBorderStyle = FormBorderStyle.None; this.AllowTransparency = true; this.BackColor = Color.AliceBlue;//цвет фона this.TransparencyKey = this.BackColor;//он же будет заменен на прозрачный цвет 

The same can be done from the constructor ...

  • And how to make it so that the borders remain and for them you can pull / stretch the shape? - Smash

For WPF

Set the window properties of AllowTransparency = true and Background=Transparent .

  • Can you please tell me how to do this for WinForms? - MikroFF
  • For WinForms, I do not know, have not tried. - ganouver