I have a borderless form with it's Opacity set to 60% so the background
shows through. It looks very nice. But I'd like to round the corners of
this form. All the techniques I've seen so far for creating shaped forms
involve using the TransparencyKey property of the form. But this doesn't
work with a form that is translucent because the form color varies at
runtime based on the background colors that are showing through.
Does anybody have any ideas about ways around this?

Re: Rounded Corners on Translucent Form by Tim

Tim
Fri May 14 01:06:59 CDT 2004

What about a custom Region? You could use a GraphicsPath object to build the
desired shape of your Form and then just create a Region object, passing
this GraphicsPath object into the constructor, and assign it to the Region
property of the Form.

--
Tim Wilson
.Net Compact Framework MVP
{cf147fdf-893d-4a88-b258-22f68a3dbc6a}
"Steve C. Orr [MVP, MCSD]" <Steve@Orr.net> wrote in message
news:ulqTYXXOEHA.3044@TK2MSFTNGP10.phx.gbl...
> I have a borderless form with it's Opacity set to 60% so the background
> shows through. It looks very nice. But I'd like to round the corners of
> this form. All the techniques I've seen so far for creating shaped forms
> involve using the TransparencyKey property of the form. But this doesn't
> work with a form that is translucent because the form color varies at
> runtime based on the background colors that are showing through.
> Does anybody have any ideas about ways around this?
>
>



Re: Rounded Corners on Translucent Form by hirf-spam-me-here

hirf-spam-me-here
Fri May 14 08:22:42 CDT 2004

* "Steve C. Orr [MVP, MCSD]" <Steve@Orr.net> scripsit:
> I have a borderless form with it's Opacity set to 60% so the background
> shows through. It looks very nice. But I'd like to round the corners of
> this form. All the techniques I've seen so far for creating shaped forms
> involve using the TransparencyKey property of the form. But this doesn't
> work with a form that is translucent because the form color varies at
> runtime based on the background colors that are showing through.

\\\
\\\
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
p.Dispose()
///

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

Re: Rounded Corners on Translucent Form by Steve

Steve
Fri May 14 12:15:53 CDT 2004

This is perfect!
Thank you so much.


"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:2gjvjiF3i6a3U4@uni-berlin.de...
> * "Steve C. Orr [MVP, MCSD]" <Steve@Orr.net> scripsit:
> > I have a borderless form with it's Opacity set to 60% so the background
> > shows through. It looks very nice. But I'd like to round the corners
of
> > this form. All the techniques I've seen so far for creating shaped
forms
> > involve using the TransparencyKey property of the form. But this
doesn't
> > work with a form that is translucent because the form color varies at
> > runtime based on the background colors that are showing through.
>
> \\\
> \\\
> 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
> p.Dispose()
> ///
>
> --
> Herfried K. Wagner [MVP]
> <URL:http://dotnet.mvps.org/>