Tute
Tute

Reputation: 7013

Irregular shaped Windows Form (C#)

What is the easiest way to do this? Is it possible with managed code?

Upvotes: 20

Views: 10764

Answers (2)

Geoff
Geoff

Reputation: 3769

this.BackgroundImage = //Image
this.FormBorderStyle = FormBorderStyle.None;
this.Width = this.BackgroundImage.Width;
this.Height = this.BackgroundImage.Height;
this.TransparencyKey = Color.FromArgb(0, 255, 0); //Contrast Color

This allows you to create a form based on an image, and use transparency index to make it seem as though the form is not rectangular.

Upvotes: 30

Jobi Joy
Jobi Joy

Reputation: 50028

@Geoff shows the right way in winforms.

But If you are planning to use WPF instead of Winforms then WPF(.NET3.0+) gives very flexible ways to create anyshape custom windows. Check out this article also http://www.codeproject.com/KB/WPF/wpfpopup.aspx

Upvotes: 8

Related Questions