VB icon

Clip edges of forms to give that rounded feel

Email
Submitted on: 1/1/2015 4:30:00 PM
By: Dave Matthews (from psc cd)  
Level: Beginner
User Rating: By 3 Users
Compatibility: VB.NET
Views: 1083
 
     This code will round the edges of your form to give that clipped/rounded look.
 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
// for :Clip edges of forms to give that rounded feel
//**************************************
'//**************************************
'// 
'// Name: Customized Form Shapes
'// Description:This simple piece of code
'//demonstrates using the new cool customized
'//form shapes feature of VB.NET !
'// Edited/Modified by David Matthews
'// Original Author: Tuncay Akbas
'//
'//This code is copyrighted and has
'// limited warranties.Please see 
'// http://www.Planet-Source-Code
'// .com/xq/ASP/txtCodeId.796/lngWId
'// .10/qx/vb/scripts/ShowCode.htm
'//for details.
'//**************************************
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Clip edges of forms to give that rounded feel
// Description:This code will round the edges of your form to give that clipped/rounded look.
// By: Dave Matthews (from psc cd)
//
// Assumes:make sure you include this at the top:
Imports System.Drawing.Drawing2D
//
// Side Effects:Setting the 'pc' value to much smaller than .17 will clip your close button. So make sure you can exit some other way (usually Alt+F4 works!)
//**************************************

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
 Dim Pth As New GraphicsPath(), pc As Decimal = 0.18
 Pth.AddEllipse(New Rectangle(-Me.Width * pc, -Me.Height * pc, Me.Width * (1 + 2 * pc), Me.Height * (1 + 2 * pc)))
 Me.Region = New Region(Pth)
End Sub


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.