-2

I want to reduce opacity for form only, not for controls on forms. I reduced opacity for form, but the panel opacity also reduced.

I don't want to reduce panel opacity. How can I to do this using c#?

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
Shankar Sha
  • 119
  • 1
  • 4

2 Answers2

0

Instead of setting the opacity for a form, try to set the form to transparent backgroundcolor and use a seperate element (in WPF that could be e.g. a grid) to fill your form and set the opacity there.

Ben
  • 925
  • 5
  • 11
0

Refering to this post, you can use HatchBrush Class.

using System.Drawing.Drawing2D;

    private void Form1_Paint(object sender, PaintEventArgs e)
    {
        var hb = new HatchBrush(HatchStyle.Percent50, this.TransparencyKey);

        e.Graphics.FillRectangle(hb,this.DisplayRectangle);
    }
Community
  • 1
  • 1
PCpractico
  • 439
  • 2
  • 9