472,965 Members | 2,266 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,965 software developers and data experts.

How to have a Border with Rounded Corners

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
2 7604
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steve | last post by:
Is it possible to create a border around an element that can size dynamically and has rounded corners? I know that with the use of a background image I can create a static border, but I need the...
4
by: Dan V. | last post by:
What is the best way to have a background image stretch and have the 'left rounded corner' look. Please see the top header at this website for an example: www.kingtree.ca and...
3
by: Pierre Jelenc | last post by:
I am trying to put a graphical border along the top, left, and right edges of a page. For left and top I have an oversize GIF with the proper graphics used as the background-image of either the...
2
by: meltedown | last post by:
I noticed that the footer menu on the bottom with rounded corners only uses one image of a rounded corner:img/round15_bot.gif This one image seems to be used for all four corners, but that can't...
8
by: TheCornjerker | last post by:
I've been looking into what method I should use to show rounded corners (and I've found a lot). My question is why does Google seems to mostly use the table method with an image in each corner. ...
5
by: Stuart Ferguson | last post by:
I am looking to create the effect shown in the image (http://img291.imageshack.us/img291/4476/effectuc6.jpg) this is taken from www.asp.net. I was wondering if there is a specific technique to...
0
by: eggsurplus | last post by:
<em>I just posted this in the wrong forum so sorry if anyone gets a dup!</em> I'm working on a slide down horizontal menu and I'm having issues getting the border around the submenu to display...
2
by: raknin | last post by:
Hi, I am looking for a css and js solution for making rounded corners, with no images. Currently I tried to use nify corners as describe in http://www.html.it/articoli/nifty/index.html in example...
6
by: moondaddy | last post by:
I need to be able to make polygons with rounded corners. This will be to draw group outlines around shapes in a diagramming tool in wpf. all angles in the polygon will be 90 degrees, but somehow...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.