By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,694 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,694 IT Pros & Developers. It's quick & easy.

How to have a Border with Rounded Corners

P: n/a
Hi,

I have several panels that holds bunch of controls with information on
my forms. My form has background image property set to an image that
has borders defining where my panel comes and that border is rounded
so when I set my panels border stile to none, the panel appear to have
the rounded border (that comes from the forms background image.

This looks really nice, but the problem is that my forms can not be
resizable then, since the background image is of fixed size.

How can I draw a border with rounded corners around my panel or other
controls and make it looks nice even when form is resized ?

Any help will be appreciated.
_dino_
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

I had this code kindly posted for me in this group a while back and it gives
curved corners to a form. I think something similar will work for Controls.

Private Sub BaseForm_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Draw Form

If Not Me.DesignMode Then 'Just learnt this today!!

Me.FormBorderStyle = FormBorderStyle.None
Me.StartPosition = FormStartPosition.CenterScreen
Me.Size = New Size(800, 500)

Dim p As New System.Drawing.Drawing2D.GraphicsPath

Dim CurveSize As Int32 = 250

p.StartFigure()

p.AddArc(New Rectangle(0, 0, CurveSize, CurveSize), 180, 90)

p.AddLine(CurveSize, 0, Me.Width - CurveSize, 0)

p.AddArc(New Rectangle(Me.Width - CurveSize, 0, CurveSize,
CurveSize), -90, 90)

p.AddLine(Me.Width, CurveSize, Me.Width, Me.Height - CurveSize)

p.AddArc(New Rectangle(Me.Width - CurveSize, Me.Height -
CurveSize, CurveSize, CurveSize), 0, 90)

p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)

p.AddArc(New Rectangle(0, Me.Height - CurveSize, CurveSize,
CurveSize), 90, 90)

p.CloseFigure()

Me.Region = New Region(p)

Me.BackColor = Color.Teal

p.Dispose()

end if

End Sub
--

Rod Gill
Project MVP
Visit www.msproject-systems.com for Project Companion Tools and more
"Dino Buljubasic" <di**@noplacelikehome.com> wrote in message
news:ki********************************@4ax.com...
Hi,

I have several panels that holds bunch of controls with information on
my forms. My form has background image property set to an image that
has borders defining where my panel comes and that border is rounded
so when I set my panels border stile to none, the panel appear to have
the rounded border (that comes from the forms background image.

This looks really nice, but the problem is that my forms can not be
resizable then, since the background image is of fixed size.

How can I draw a border with rounded corners around my panel or other
controls and make it looks nice even when form is resized ?

Any help will be appreciated.
_dino_

Nov 21 '05 #2

P: n/a
Thanks Rod,
I appreciate your help. I will give it a try, it seams to be good.
_dion_

On Sat, 7 May 2005 15:20:36 +1200, "Rod Gill" <rod AT project-systems
DOT co DOT nz> wrote:
Hi,

I had this code kindly posted for me in this group a while back and it gives
curved corners to a form. I think something similar will work for Controls.

Private Sub BaseForm_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Draw Form

If Not Me.DesignMode Then 'Just learnt this today!!

Me.FormBorderStyle = FormBorderStyle.None
Me.StartPosition = FormStartPosition.CenterScreen
Me.Size = New Size(800, 500)

Dim p As New System.Drawing.Drawing2D.GraphicsPath

Dim CurveSize As Int32 = 250

p.StartFigure()

p.AddArc(New Rectangle(0, 0, CurveSize, CurveSize), 180, 90)

p.AddLine(CurveSize, 0, Me.Width - CurveSize, 0)

p.AddArc(New Rectangle(Me.Width - CurveSize, 0, CurveSize,
CurveSize), -90, 90)

p.AddLine(Me.Width, CurveSize, Me.Width, Me.Height - CurveSize)

p.AddArc(New Rectangle(Me.Width - CurveSize, Me.Height -
CurveSize, CurveSize, CurveSize), 0, 90)

p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)

p.AddArc(New Rectangle(0, Me.Height - CurveSize, CurveSize,
CurveSize), 90, 90)

p.CloseFigure()

Me.Region = New Region(p)

Me.BackColor = Color.Teal

p.Dispose()

end if

End Sub


Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.