|
-
Jul 11th, 2004, 06:29 AM
#1
Thread Starter
New Member
Rounded Corners In VB.NET (Forms)
I have been looking all other the net, searching the forum. I can't find any API for rouding corners for forms in VB.NET.
Please help me find a example code, since I am kind of newbie!
Thanks in advance.
-
Jul 11th, 2004, 12:36 PM
#2
Frenzied Member
Check out Region Master Controls - not only rounded corners, but even discontinious forms - really neat stuff.
http://www.windowsforms.net/ControlG...219&tabindex=0
-
Jul 11th, 2004, 01:16 PM
#3
PowerPoster
Hi,
Perhaps you can obtain the same effect by coding if you create an ellipse with a different backcolor and place all your controls inside it. Then make the form fullscreen, set the form.text to "" and hide the controlbox. viz
VB Code:
With Me
.WindowState = FormWindowState.Maximized
.Text = ""
.ControlBox = False
End With
You can, of course, put hyperbolic curves on your form and backcolor the area inside or outside of them different colors, if you don't want a pure ellipse.
Last edited by taxes; Jul 11th, 2004 at 01:27 PM.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jul 12th, 2004, 04:25 AM
#4
Thread Starter
New Member
Still need help 
I need a example-code of rounded corners in a form!
-
Jul 12th, 2004, 08:22 AM
#5
Frenzied Member
The Region Master download is an example, complete with full source code. Have you even tried it?
-
Jul 12th, 2004, 11:35 AM
#6
Hyperactive Member
To draw rounded corners it is necessary to familiarize yourself with the GraphicsPath object as well as Arcs and pretty much all drawing concepts.
This code will do what you ask, but you will have to modify it for your purposes:
VB Code:
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim gpBrush As LinearGradientBrush
Dim gp As New GraphicsPath
gpBrush = New LinearGradientBrush(New Point(0, 0), New Point(Me.Width, 40), Color.MidnightBlue, Color.White)
gp.AddArc(0, 0, 20, 20, 180, 90)
gp.AddArc(Me.Width - 22, 0, 20, 20, 270, 90)
'e.Graphics.FillRectangle(gpBrush, New Rectangle(0, 0, Me.Width, 20))
e.Graphics.FillPath(gpBrush, gp)
End Sub
Whadayamean it doesn't work....
It works fine on my machine!

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|