10 985
Hi,
Here is how i do it.
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim gp As GraphicsPath = New GraphicsPath
Dim radius As Single
radius = 25
gp.AddLine(radius, 0, Width - (radius * 2), 0)
gp.AddArc(Width - (radius * 2), 0, radius * 2, radius * 2, 270, 90)
gp.AddLine( Width, radius, Width, Height - (radius * 2))
gp.AddArc(Width - (radius * 2), Height - (radius * 2), radius * 2, radius *
2, 0, 90)
gp.AddLine(Width - (radius * 2), Height, radius, Height)
gp.AddArc(0, Height - (radius * 2), radius * 2, radius * 2, 90, 90)
gp.AddLine(0, Height - (radius * 2), 0, radius)
gp.AddArc(0, 0, radius * 2, radius * 2, 180, 90)
gp.CloseFigure()
Dim regRoundRect As New Region(gp)
Me.Region = regRoundRect
End Sub
Ken
------------------
"William Ryan" <do********@nospam.comcast.net> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl... Herfried:
A while back you posted a really cool way to round the corners of a form. I thought I had it saved, but if you have it handy, would you kindly post it? TIA,
Bill
-- Cordially,
W.G. Ryan do********@comcast.nospam.net www.devbuzz.com www.knowdotnet.com
Thanks Ken!
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uV**************@tk2msftngp13.phx.gbl... Hi,
Here is how i do it. Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim gp As GraphicsPath = New GraphicsPath
Dim radius As Single
radius = 25
gp.AddLine(radius, 0, Width - (radius * 2), 0)
gp.AddArc(Width - (radius * 2), 0, radius * 2, radius * 2, 270, 90)
gp.AddLine( Width, radius, Width, Height - (radius * 2))
gp.AddArc(Width - (radius * 2), Height - (radius * 2), radius * 2, radius
* 2, 0, 90)
gp.AddLine(Width - (radius * 2), Height, radius, Height)
gp.AddArc(0, Height - (radius * 2), radius * 2, radius * 2, 90, 90)
gp.AddLine(0, Height - (radius * 2), 0, radius)
gp.AddArc(0, 0, radius * 2, radius * 2, 180, 90) gp.CloseFigure()
Dim regRoundRect As New Region(gp)
Me.Region = regRoundRect
End Sub
Ken ------------------ "William Ryan" <do********@nospam.comcast.net> wrote in message news:OB**************@TK2MSFTNGP09.phx.gbl... Herfried:
A while back you posted a really cool way to round the corners of a
form. I thought I had it saved, but if you have it handy, would you kindly post it? TIA,
Bill
-- Cordially,
W.G. Ryan do********@comcast.nospam.net www.devbuzz.com www.knowdotnet.com
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote...
I can never resist messing with code... one might consider defining diameter
and avoid a number of identical multiplications
Dim radius As Single = 25
Dim diameter As Single = ( radius * 2 )
gp.AddLine(radius, 0, Width - diameter, 0)
gp.AddArc(Width - diameter, 0, diameter, diameter, 270, 90)
etc.
I can't get this one to work...
Am I missing something here?
Gary
Hi,
The graphicspath is in the system.drawing.drawing2d namespace. Add this
to the top of your file.
Imports System.Drawing.Drawing2D
Ken
-----------------------
"Didymus" <di************@hotmail.com> wrote in message
news:Ov**************@TK2MSFTNGP11.phx.gbl... I can't get this one to work...
Am I missing something here?
Gary
* "Armin Zingler" <az*******@freenet.de> scripsit: A while back you posted a really cool way to round the corners of a form. [...] I'm not Herfried, but you might find the answer here: http://groups.google.com/groups?as_e...*&as_scoring=d
;-)
<http://groups.google.com/groups?selm=OT79ZF6rDHA.2028%40TK2MSFTNGP10.phx.gb l>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Just because you have that in your favourites..... ;-)))
--
HTH,
-- Tom Spink, Über Geek
Please respond to the newsgroup,
so all can benefit
" System.Reflection Master "
==== Converting to 2002 ====
Remove inline declarations
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ut**************@TK2MSFTNGP10.phx.gbl... * "Armin Zingler" <az*******@freenet.de> scripsit: A while back you posted a really cool way to round the corners of a
form. [...] I'm not Herfried, but you might find the answer here: http://groups.google.com/groups?as_e...*&as_scoring=d ;-)
<http://groups.google.com/groups?selm...FTNGP10.phx.gb
l> -- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet>
* "Tom Spink" <thomasdotspinkat@ntlworlddotcom> scripsit: Just because you have that in your favourites..... ;-)))
I used Google Groups Search to locate the post.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Thanks Ken,
Always the simple solution <grin>
Gary This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Konrad |
last post by:
Hi
This is maybe simple question but
how to render DataGrid and Tables
with rounded corners?
Thanks
Konrad
|
by: kidelectric |
last post by:
The issue I am having is that I would like to be able to drag-and-drop div elements that have rounded corners.* Since these elements will be dynamically created (including background color), I could...
|
by: PWS |
last post by:
I am despertely trying get a DIV to look like a box with rounded
corners.
I can find load of examples this where the first line of text has the
top graphic and the last line of text has the...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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...
|
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,...
| |