Re: How to have a Border with Rounded Corners
- From: "Rod Gill" <rod AT project-systems DOT co DOT nz>
- Date: Sat, 7 May 2005 15:20:36 +1200
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" <dino@xxxxxxxxxxxxxxxxxxx> wrote in message
news:ki7n71958mo3448o2btsrha95bs43f626a@xxxxxxxxxx
> 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_
.
- Follow-Ups:
- Re: How to have a Border with Rounded Corners
- From: Dino Buljubasic
- Re: How to have a Border with Rounded Corners
- References:
- How to have a Border with Rounded Corners
- From: Dino Buljubasic
- How to have a Border with Rounded Corners
- Prev by Date: RE: Option strict require more casting?
- Next by Date: XSD annotations with typed datasets
- Previous by thread: How to have a Border with Rounded Corners
- Next by thread: Re: How to have a Border with Rounded Corners
- Index(es):
Relevant Pages
|