Live Chat Icon For mobile
Live Chat Icon

How can I create non-rectangular windows

Platform: WinForms| Category: Paths and Regions

Check out this Microsoft KB article, Shaped Windows Forms and Controls in Visual Studio .NET

There are 2 ways to create non-rectangular windows:

1) The Control.Region property (Form inherits this of course):

	GraphicsPath gp = new GraphicsPath();
	this.Region = new Region(gp);

	Dim gp As New GraphicsPath()
	gp.AddEllipse(0, 0, 100, 100)
	gp.AddRectangle(50, 50, 100, 100)
	Me.Region = New [Region](gp)

2) Use the Form.TransparencyKey property. This tells the form not to paint any pixels that match the color of the TransparencyKey. So you can make your fancy skin bitmap, then set the TransparencyKey to be, say Color.Red,
then all the pixels that are RGB(255,0,0) will be transparent.

(from on microsoft.public.dotnet.framework.windowsforms)

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.