|
P: n/a
|
Mike D
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. | |
Share this Question
|
P: n/a
|
One Handed Man
Put a panel on the form and then make the form tranparent. You can add the
controls over the panel.
OHM
Mike D wrote:[color=blue]
> 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.[/color] | | |
P: n/a
|
Herfried K. Wagner [MVP]
* "Mike D" <dibblm@hotmail.com> scripsit:[color=blue]
> 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.[/color]
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> | | |
P: n/a
|
One Handed Man
Forget my post, it was untested and simply incorrect.
Sorry - OHM
One Handed Man wrote:[color=blue]
> Put a panel on the form and then make the form tranparent. You can
> add the controls over the panel.
>
> OHM
>
>
>
> Mike D wrote:[color=green]
>> 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.[/color][/color] | | |
P: n/a
|
Mike D
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]" <hirf-spam-me-here@gmx.at> wrote in message
news:bpj174$1pdf3q$2@ID-208219.news.uni-berlin.de...[color=blue]
> * "Mike D" <dibblm@hotmail.com> scripsit:[color=green]
> > I am looking for a way in vb.net to take a form with sharp corners and[/color][/color]
just[color=blue][color=green]
> > round off the corners a bit so they arent so sharp.
> >
> > I have seen this done in other applications.[/color]
>
> 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>[/color] | | |
P: n/a
|
Mike D
What does the 'P' reffence? I am doing this in vb.net if that helps any?
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:bpj174$1pdf3q$2@ID-208219.news.uni-berlin.de...[color=blue]
> * "Mike D" <dibblm@hotmail.com> scripsit:[color=green]
> > I am looking for a way in vb.net to take a form with sharp corners and[/color][/color]
just[color=blue][color=green]
> > round off the corners a bit so they arent so sharp.
> >
> > I have seen this done in other applications.[/color]
>
> 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>[/color] | | |
P: n/a
|
Mike D
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]" <hirf-spam-me-here@gmx.at> wrote in message
news:bpj174$1pdf3q$2@ID-208219.news.uni-berlin.de...[color=blue]
> * "Mike D" <dibblm@hotmail.com> scripsit:[color=green]
> > I am looking for a way in vb.net to take a form with sharp corners and[/color][/color]
just[color=blue][color=green]
> > round off the corners a bit so they arent so sharp.
> >
> > I have seen this done in other applications.[/color]
>
> 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>[/color] | | |
P: n/a
|
William Ryan
Nice post - neither quick nor dirty but definitely way cool.
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:bpj174$1pdf3q$2@ID-208219.news.uni-berlin.de...[color=blue]
> * "Mike D" <dibblm@hotmail.com> scripsit:[color=green]
> > I am looking for a way in vb.net to take a form with sharp corners and[/color][/color]
just[color=blue][color=green]
> > round off the corners a bit so they arent so sharp.
> >
> > I have seen this done in other applications.[/color]
>
> 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>[/color] | | |
P: n/a
|
Mike D
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" <dibblm@hotmail.com> wrote in message
news:%234lKCZ4rDHA.2432@TK2MSFTNGP10.phx.gbl...[color=blue]
> I am looking for a way in vb.net to take a form with sharp corners and[/color]
just[color=blue]
> round off the corners a bit so they arent so sharp.
>
> I have seen this done in other applications.
>
>[/color] | | |
P: n/a
|
Bernie Yaeger
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" <dibblm@hotmail.com> wrote in message
news:%234lKCZ4rDHA.2432@TK2MSFTNGP10.phx.gbl...[color=blue]
> I am looking for a way in vb.net to take a form with sharp corners and[/color]
just[color=blue]
> round off the corners a bit so they arent so sharp.
>
> I have seen this done in other applications.
>
>[/color] | | |
P: n/a
|
Mike D
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" <berniey@cherwellinc.com> wrote in message
news:e0zcRK6rDHA.3196@TK2MSFTNGP11.phx.gbl...[color=blue]
> 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" <dibblm@hotmail.com> wrote in message
> news:%234lKCZ4rDHA.2432@TK2MSFTNGP10.phx.gbl...[color=green]
> > I am looking for a way in vb.net to take a form with sharp corners and[/color]
> just[color=green]
> > round off the corners a bit so they arent so sharp.
> >
> > I have seen this done in other applications.
> >
> >[/color]
>
>[/color] | | |
P: n/a
|
Herfried K. Wagner [MVP]
* "Mike D" <dibblm@hotmail.com> scripsit:[color=blue]
> 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?[/color]
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> | | |
P: n/a
|
Herfried K. Wagner [MVP]
* "Bernie Yaeger" <berniey@cherwellinc.com> scripsit:
[...]
I remember I saw the code somewhere...
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet> | | |
P: n/a
|
Herfried K. Wagner [MVP]
* "Mike D" <dibblm@hotmail.com> scripsit:[color=blue]
> 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[/color]
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> | | |
P: n/a
|
Chris Dunaway
On Thu, 20 Nov 2003 15:20:44 -0500, Mike D wrote:
[color=blue]
> NOPE. Sorry but thanks anyways.
>
> See, What I am trying to do is to keep the Border. Both examples have had[/color]
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. | | |
P: n/a
|
Bernie Yaeger
Yep, got it from you. I always pass along good work whenever it appears
appropriate.
Bernie
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:bpj8ae$1orbvv$2@ID-208219.news.uni-berlin.de...[color=blue]
> * "Bernie Yaeger" <berniey@cherwellinc.com> scripsit:
> [...]
>
> I remember I saw the code somewhere...
>
> --
> Herfried K. Wagner [MVP]
> <http://www.mvps.org/dotnet>[/color] | | |
P: n/a
|
Herfried K. Wagner [MVP]
* "Bernie Yaeger" <berniey@cherwellinc.com> scripsit:[color=blue]
> Yep, got it from you. I always pass along good work whenever it appears
> appropriate.[/color]
No problem... Thx!
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet> | | |
P: n/a
|
One Handed Man
Yes, use the DataTable.Clear() method.
OHM
One Handed Man wrote:[color=blue]
> Put a panel on the form and then make the form tranparent. You can
> add the controls over the panel.
>
> OHM
>
>
>
> Mike D wrote:[color=green]
>> 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.[/color][/color] | | |
P: n/a
|
Mike D
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" <berniey@cherwellinc.com> wrote in message
news:e3w1ZO8rDHA.2248@TK2MSFTNGP09.phx.gbl...[color=blue]
> Yep, got it from you. I always pass along good work whenever it appears
> appropriate.
>
> Bernie
>
> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
> news:bpj8ae$1orbvv$2@ID-208219.news.uni-berlin.de...[color=green]
> > * "Bernie Yaeger" <berniey@cherwellinc.com> scripsit:
> > [...]
> >
> > I remember I saw the code somewhere...
> >
> > --
> > Herfried K. Wagner [MVP]
> > <http://www.mvps.org/dotnet>[/color]
>
>[/color] | | Post your reply Help answer this question
Didn't find the answer to your Visual Basic .NET question?
| | Question stats - viewed: 14923
- replies: 18
- date asked: Nov 20 '05
|