Rounded Corners
- How can I round the bottom corners on my forms?
Answers
- Hi James12314909,
For just the bottom corners, please try this code, you can also resize the FORM
by the edges and the rounded corners will remain.
Regards and happy coding from,
Tattooed Bloke.
Public Class Form1 Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint 'Change this to whatever size you require.>> Dim RoundedCornerSize As Integer = 150 Dim g As New System.Drawing.Drawing2D.GraphicsPath g.AddLine(0, 0, Me.Width, 0) g.AddLine(Me.Width, 0, Me.Width, Me.Height - RoundedCornerSize) g.AddArc(Me.Width - RoundedCornerSize, Me.Height - RoundedCornerSize, RoundedCornerSize, RoundedCornerSize, 0, 90) g.AddLine(Me.Width - RoundedCornerSize, Me.Height, RoundedCornerSize, Me.Height) g.AddArc(0, Me.Height - RoundedCornerSize, RoundedCornerSize, RoundedCornerSize, 90, 90) g.AddLine(0, Me.Height - RoundedCornerSize, 0, 0) Me.Region = New Region(g) End Sub Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize Me.Refresh() End Sub End Class
- Proposed As Answer byShariqDON Friday, November 06, 2009 1:48 AM
- Marked As Answer byJeff ShanMSFT, ModeratorTuesday, November 10, 2009 7:29 AM
All Replies
- See if the following helps:
http://www.devasp.net/net/articles/display/312.html
Paul ~~~~ Microsoft MVP (Visual Basic) - Hi James12314909,
For just the bottom corners, please try this code, you can also resize the FORM
by the edges and the rounded corners will remain.
Regards and happy coding from,
Tattooed Bloke.
Public Class Form1 Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint 'Change this to whatever size you require.>> Dim RoundedCornerSize As Integer = 150 Dim g As New System.Drawing.Drawing2D.GraphicsPath g.AddLine(0, 0, Me.Width, 0) g.AddLine(Me.Width, 0, Me.Width, Me.Height - RoundedCornerSize) g.AddArc(Me.Width - RoundedCornerSize, Me.Height - RoundedCornerSize, RoundedCornerSize, RoundedCornerSize, 0, 90) g.AddLine(Me.Width - RoundedCornerSize, Me.Height, RoundedCornerSize, Me.Height) g.AddArc(0, Me.Height - RoundedCornerSize, RoundedCornerSize, RoundedCornerSize, 90, 90) g.AddLine(0, Me.Height - RoundedCornerSize, 0, 0) Me.Region = New Region(g) End Sub Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize Me.Refresh() End Sub End Class
- Proposed As Answer byShariqDON Friday, November 06, 2009 1:48 AM
- Marked As Answer byJeff ShanMSFT, ModeratorTuesday, November 10, 2009 7:29 AM
- Hi everyone,
I was thinking of adding a post here which would be code for a FORM whereby you could
turn ON / OFF each of the 4 corners between Rounded or RightAngled.
As addition to that idea, how about a FORM where you can have each of the corners either;
Rounded / Right-Angled / SlantedAt45Degrees
This could be done by adding 4 properties to a FORM which I suggest as;
TopRightCornerStyle
TopLeftCornerStyle
BottomRightCornerStyle
BottomLeftCornerStyle
Would anyone be interested?
Happy coding from,
Tattooed Bloke - @Tattooed Bloke:
It appears that you're good at Windows Forms.Could you please take a look/shot at this question I posted long ago: Form Border Color Design/Appearance
Only performance counts! @Tattooed Bloke:
It appears that you're good at Windows Forms.Could you please take a look/shot at this question I posted long ago: Form Border Color Design/Appearance
Only performance counts!
Hello Sylva,
Interesting!!
The project as linked at.>> http://customerborderform.codeplex.com/
from.>>
http://social.msdn.microsoft.com/Forums/en-US/winformsdesigner/thread/892c4fdd-348c-4189-8607-e60adc793f76
uses 13 separate C# files.
It may take me sometime to convert each of them.
If you want to post your email address in the form of sylva <at> wherever.com
( that way you will avoid spam bots ), I will get back to you later if I manage to convert it to Vb.
Regards,
Tattooed Bloke- Thanks, TB. I will post the e mail address at the Thread itself so that this thread is not derailed.
Many thanks.
Only performance counts! Thanks, TB. I will post the e mail address at the Thread itself so that this thread is not derailed.
Many thanks.
Only performance counts!
Hello Sylva,
I have replied there too.
Happy coding from,
Tattooed Bloke


