Windows Form Hole

How can I create a dynamic “hole” in the form of a window through which the user can see the actual desktop instead of the form? Right now I have created a translucent shape on top of the entire screen, and I'm looking to see this translucent shape.

+5
source share
2 answers

Alternatively, if you need a rectangular “hole” shape, you can set the form property TransparencyKeyto a specific color and then create a panel with a background of the same color. (This panel will be transparent at startup.)

+4
source

Use the Region form .

Rectangle rect = new Rectangle(Point.Empty, this.Size);
Region region = new Region(rect);

rect.Inflate(-1 * (this.Width / 3), -1 * (this.Height / 3));
region.Exclude(rect);

this.Region = region;

This should shed a hole through your mold.

+9

All Articles