TechTalkz.com Logo Ask the Expert

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Software World > Programming

[.NET] Non Rectangular Forms

Programming


Reply
 
LinkBack Thread Tools Display Modes
Old 06-12-2005, 05:11 PM   #1
Webmaster
 
Strider's Avatar
 
Join Date: Nov 2005
Location: The Last City!
Posts: 4,164
Thanks: 430
Thanked 462 Times in 403 Posts
Rep Power: 2739 Strider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just Great


OS: Windows XP Windows Server 2003 / Windows Server 2008 Windows 7 Linux


[.NET] Non Rectangular Forms

Have you ever wondered how you can create nonrectangular forms? Windows Media Player is a good example. When you switch to different skins, the border changes shapes. It seems like quite a difficult task, but it ends up being extremely simple. It's really only a few lines of code! But these few lines of code can make a big difference in the visual impression your project creates.

First create a new Windows Forms project using C#. (This can be done in any .NET language, but we'll use C# for this example.) Add a button to the middle of the form. Add this code to the button:


Code:
private void button1_Click(object sender, System.EventArgs e) 
{ 
System.Drawing.Drawing2D.GraphicsPath p = new System.Drawing.Drawing2D.GraphicsPath(); 
int width = this.ClientSize.Width; 
int height = this.ClientSize.Height; 
p.AddClosedCurve(new Point[]{new Point(width/2, height/10), 
new Point(width,0), new Point(width, height/3), 
new Point(width-width/3, height), 
new Point(width/7, height-height/} ); 
this.Region = new Region(p); 
}
Strider is online now   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forms and fields rexmann Microsoft Office 3 27-09-2007 04:29 PM
Forms SuzieB Microsoft Office 1 04-09-2007 05:31 PM
Cannot fill out forms in IE7 RR2 Internet Explorer 4 29-08-2007 07:26 AM
Cannot fill out forms in IE7 RR2 Internet Explorer 0 29-08-2007 07:25 AM
Cannot fill out forms in IE7 RR2 Internet Explorer 3 29-08-2007 07:24 AM


< Home - Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 04:04 PM.


vBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2010, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional