Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Irregular shaped Windows Form (C#)

Tags:

c#

.net

winforms

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

like image 458
Tute Avatar asked Oct 06 '08 23:10

Tute


2 Answers

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.

like image 115
2 revs, 2 users 89% Avatar answered Oct 15 '22 18:10

2 revs, 2 users 89%


@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

like image 40
Jobi Joy Avatar answered Oct 15 '22 18:10

Jobi Joy