semi-transparent form but opaque Controls in C#

c#, transparency, winforms

Solution

You can use a hatch brush with a certain percentage, for example:

    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);
    }

Problem

How to make semi transparent form in C# windows form application I have tried the `TransparentKey` which makes it full-transparent. and tried `Opacity` but it effects the whole form (with controls). I want only form part to be semi-transparent but not Controls.

Original source

Related problems