473,396 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Simply round corners of a form

I am looking for a way in vb.net to take a form with sharp corners and just
round off the corners a bit so they arent so sharp.

I have seen this done in other applications.
Nov 20 '05 #1
18 42179
Put a panel on the form and then make the form tranparent. You can add the
controls over the panel.

OHM

Mike D wrote:
I am looking for a way in vb.net to take a form with sharp corners
and just round off the corners a bit so they arent so sharp.

I have seen this done in other applications.

Nov 20 '05 #2
* "Mike D" <di****@hotmail.com> scripsit:
I am looking for a way in vb.net to take a form with sharp corners and just
round off the corners a bit so they arent so sharp.

I have seen this done in other applications.


Quick and dirty:

\\\
Me.FormBorderStyle = FormBorderStyle.None
Me.Height = 300
Me.Width = 400
Dim p As New Drawing2D.GraphicsPath()
p.StartFigure()
p.AddArc(New Rectangle(0, 0, 40, 40), 180, 90)
p.AddLine(40, 0, Me.Width - 40, 0)
p.AddArc(New Rectangle(Me.Width - 40, 0, 40, 40), -90, 90)
p.AddLine(Me.Width, 40, Me.Width, Me.Height - 40)
p.AddArc(New Rectangle(Me.Width - 40, Me.Height - 40, 40, 40), 0, 90)
p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)
p.AddArc(New Rectangle(0, Me.Height - 40, 40, 40), 90, 90)
p.CloseFigure()
Me.Region = New Region(p)
Me.BackColor = Color.Red
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Forget my post, it was untested and simply incorrect.

Sorry - OHM
One Handed Man wrote:
Put a panel on the form and then make the form tranparent. You can
add the controls over the panel.

OHM

Mike D wrote:
I am looking for a way in vb.net to take a form with sharp corners
and just round off the corners a bit so they arent so sharp.

I have seen this done in other applications.

Nov 20 '05 #4
WOW. I was thinking that there was something quick and simple. But I highly
appreciate the technical approach, Realizing that all things dont come in
quick and dirty flavors
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bp*************@ID-208219.news.uni-berlin.de...
* "Mike D" <di****@hotmail.com> scripsit:
I am looking for a way in vb.net to take a form with sharp corners and just round off the corners a bit so they arent so sharp.

I have seen this done in other applications.


Quick and dirty:

\\\
Me.FormBorderStyle = FormBorderStyle.None
Me.Height = 300
Me.Width = 400
Dim p As New Drawing2D.GraphicsPath()
p.StartFigure()
p.AddArc(New Rectangle(0, 0, 40, 40), 180, 90)
p.AddLine(40, 0, Me.Width - 40, 0)
p.AddArc(New Rectangle(Me.Width - 40, 0, 40, 40), -90, 90)
p.AddLine(Me.Width, 40, Me.Width, Me.Height - 40)
p.AddArc(New Rectangle(Me.Width - 40, Me.Height - 40, 40, 40), 0, 90)
p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)
p.AddArc(New Rectangle(0, Me.Height - 40, 40, 40), 90, 90)
p.CloseFigure()
Me.Region = New Region(p)
Me.BackColor = Color.Red
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #5
What does the 'P' reffence? I am doing this in vb.net if that helps any?
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bp*************@ID-208219.news.uni-berlin.de...
* "Mike D" <di****@hotmail.com> scripsit:
I am looking for a way in vb.net to take a form with sharp corners and just round off the corners a bit so they arent so sharp.

I have seen this done in other applications.


Quick and dirty:

\\\
Me.FormBorderStyle = FormBorderStyle.None
Me.Height = 300
Me.Width = 400
Dim p As New Drawing2D.GraphicsPath()
p.StartFigure()
p.AddArc(New Rectangle(0, 0, 40, 40), 180, 90)
p.AddLine(40, 0, Me.Width - 40, 0)
p.AddArc(New Rectangle(Me.Width - 40, 0, 40, 40), -90, 90)
p.AddLine(Me.Width, 40, Me.Width, Me.Height - 40)
p.AddArc(New Rectangle(Me.Width - 40, Me.Height - 40, 40, 40), 0, 90)
p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)
p.AddArc(New Rectangle(0, Me.Height - 40, 40, 40), 90, 90)
p.CloseFigure()
Me.Region = New Region(p)
Me.BackColor = Color.Red
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #6
froget my last post asking what the 'P' reffrenced. I was trying to first
create a module that I could access from all my forms, However it all
errored out. I placed the code in the form load event and all worked fine.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bp*************@ID-208219.news.uni-berlin.de...
* "Mike D" <di****@hotmail.com> scripsit:
I am looking for a way in vb.net to take a form with sharp corners and just round off the corners a bit so they arent so sharp.

I have seen this done in other applications.


Quick and dirty:

\\\
Me.FormBorderStyle = FormBorderStyle.None
Me.Height = 300
Me.Width = 400
Dim p As New Drawing2D.GraphicsPath()
p.StartFigure()
p.AddArc(New Rectangle(0, 0, 40, 40), 180, 90)
p.AddLine(40, 0, Me.Width - 40, 0)
p.AddArc(New Rectangle(Me.Width - 40, 0, 40, 40), -90, 90)
p.AddLine(Me.Width, 40, Me.Width, Me.Height - 40)
p.AddArc(New Rectangle(Me.Width - 40, Me.Height - 40, 40, 40), 0, 90)
p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)
p.AddArc(New Rectangle(0, Me.Height - 40, 40, 40), 90, 90)
p.CloseFigure()
Me.Region = New Region(p)
Me.BackColor = Color.Red
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #7
Nice post - neither quick nor dirty but definitely way cool.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bp*************@ID-208219.news.uni-berlin.de...
* "Mike D" <di****@hotmail.com> scripsit:
I am looking for a way in vb.net to take a form with sharp corners and just round off the corners a bit so they arent so sharp.

I have seen this done in other applications.


Quick and dirty:

\\\
Me.FormBorderStyle = FormBorderStyle.None
Me.Height = 300
Me.Width = 400
Dim p As New Drawing2D.GraphicsPath()
p.StartFigure()
p.AddArc(New Rectangle(0, 0, 40, 40), 180, 90)
p.AddLine(40, 0, Me.Width - 40, 0)
p.AddArc(New Rectangle(Me.Width - 40, 0, 40, 40), -90, 90)
p.AddLine(Me.Width, 40, Me.Width, Me.Height - 40)
p.AddArc(New Rectangle(Me.Width - 40, Me.Height - 40, 40, 40), 0, 90)
p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)
p.AddArc(New Rectangle(0, Me.Height - 40, 40, 40), 90, 90)
p.CloseFigure()
Me.Region = New Region(p)
Me.BackColor = Color.Red
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #8
This works but does'nt. If I resize my form. I lose the formatiing. Is there
no way for me to keep the rounded corners when resizing?
"Mike D" <di****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I am looking for a way in vb.net to take a form with sharp corners and just round off the corners a bit so they arent so sharp.

I have seen this done in other applications.

Nov 20 '05 #9
Hi Mike,

Try this:
Me.FormBorderStyle = FormBorderStyle.None

' this would make the form purely the designated color, without

' the control or windowstate menus and without a caption, drag top, icon,
etc.

Me.Height = 688

Me.Width = 360

Dim p As New Drawing2D.GraphicsPath

p.StartFigure()

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

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

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

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

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

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

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

p.CloseFigure()

Me.Region = New Region(p)

Me.BackColor = Color.Thistle

HTH,

Bernie Yaeger

"Mike D" <di****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I am looking for a way in vb.net to take a form with sharp corners and just round off the corners a bit so they arent so sharp.

I have seen this done in other applications.

Nov 20 '05 #10
NOPE. Sorry but thanks anyways.

See, What I am trying to do is to keep the Border. Both examples have had
me turn it off. What I really would like to accomplish is to give users an
easier flowing lookng solution instead of all squared corners.

Something that can resized and still keep it's corners.
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:e0**************@TK2MSFTNGP11.phx.gbl...
Hi Mike,

Try this:
Me.FormBorderStyle = FormBorderStyle.None

' this would make the form purely the designated color, without

' the control or windowstate menus and without a caption, drag top, icon,
etc.

Me.Height = 688

Me.Width = 360

Dim p As New Drawing2D.GraphicsPath

p.StartFigure()

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

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

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

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

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

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

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

p.CloseFigure()

Me.Region = New Region(p)

Me.BackColor = Color.Thistle

HTH,

Bernie Yaeger

"Mike D" <di****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I am looking for a way in vb.net to take a form with sharp corners and

just
round off the corners a bit so they arent so sharp.

I have seen this done in other applications.


Nov 20 '05 #11
* "Mike D" <di****@hotmail.com> scripsit:
This works but does'nt. If I resize my form. I lose the formatiing. Is there
no way for me to keep the rounded corners when resizing?


You will have to create a new region as shown in the sample with
appropriate size and reassign it to the form's 'Region' property.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #12
* "Bernie Yaeger" <be*****@cherwellinc.com> scripsit:
[...]

I remember I saw the code somewhere...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #13
* "Mike D" <di****@hotmail.com> scripsit:
WOW. I was thinking that there was something quick and simple. But I highly
appreciate the technical approach, Realizing that all things dont come in
quick and dirty flavors


The solution only shows one way to create the irregularly shaped form.
You can archieve similar appearance by specifying the form's
'TransparenceKey' property (but I like setting the 'Region' more).

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #14
On Thu, 20 Nov 2003 15:20:44 -0500, Mike D wrote:
NOPE. Sorry but thanks anyways.

See, What I am trying to do is to keep the Border. Both examples have had


What you'll probably have to do is draw the border in the forms Paint
event. I have done that with a circular form. After assigning a circular
region, in the paint event, I had to manually draw the border.

If you need the form to be resizable, then when the forms size changes,
you'll have to recalcuate the region. The paint event should handle
drawing the border and caption.

Try asking in the drawing groups for more information as well. I may try
to make a simple example for myself. If it turns out OK, I post it.
--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 20 '05 #15
Yep, got it from you. I always pass along good work whenever it appears
appropriate.

Bernie

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bp*************@ID-208219.news.uni-berlin.de...
* "Bernie Yaeger" <be*****@cherwellinc.com> scripsit:
[...]

I remember I saw the code somewhere...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #16
* "Bernie Yaeger" <be*****@cherwellinc.com> scripsit:
Yep, got it from you. I always pass along good work whenever it appears
appropriate.


No problem... Thx!

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #17
Yes, use the DataTable.Clear() method.

OHM

One Handed Man wrote:
Put a panel on the form and then make the form tranparent. You can
add the controls over the panel.

OHM

Mike D wrote:
I am looking for a way in vb.net to take a form with sharp corners
and just round off the corners a bit so they arent so sharp.

I have seen this done in other applications.

Nov 20 '05 #18
Thank you all. You too Bernie for originating this.

Seems I am over my head yet in this field and will do as asked and resume
in the drawings group. I have read many vb books and always just skip right
over the drawings parts of the books thinking, I do nothing but databases, I
will never need that stuff. LOL. Funny how things come back in time to slap
you in your face when you aren't looking. Should have read those chapeters
on drawing now shouldn't I..
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:e3**************@TK2MSFTNGP09.phx.gbl...
Yep, got it from you. I always pass along good work whenever it appears
appropriate.

Bernie

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bp*************@ID-208219.news.uni-berlin.de...
* "Bernie Yaeger" <be*****@cherwellinc.com> scripsit:
[...]

I remember I saw the code somewhere...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


Nov 20 '05 #19

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: reneeccwest | last post by:
is there any way I can make the 4 end of table with round corner without using any images? <table border=1> <tr><td>I wanna be a round table</td></tr> </table>
3
by: Kerberos | last post by:
I haven't found in my CSS book how to create a gradient to fill a division tag, and to create a border with round corners. Is it possible using either CSS or JavaScript? I'd like to create a menu...
2
by: deepakp | last post by:
Hi, I'm trying to create a site index page. The page layout will consist of a header, left navigation and content display. The left navigation and content display should look like the image file...
17
by: Barret Bonden | last post by:
As an old programmer just now looking at VB.net I have a question: How does one simply open one form from another ? I don't mean how does one create a new instance of that form , but rather how...
0
by: Nik Coughlin | last post by:
Something that I've been trying to do for a long time is a 3 column layout where all three columns have equal height, and have rounded corners implemented using PNGs with alpha. One of my early...
2
by: virgil46 | last post by:
Trying to use niftycube that i downloaded from the web to round corner's on my webpage's. It is not working though. I'm using, "Web Expressions", as my editor.
5
by: todpeeple | last post by:
Hi can any one plz tell me urgently... is it possible to make round corners of any box (such as <div>, <span>,<table>, or any box) in asp .net page programatically or declareatively without using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.