Non rectangle form drop shadow

G

Guest

I’ve created a non rectangle form by setting the FormBorderStyle, BackColor
and TransparanceKey properties and drawing on the form in the pain event or
setting the BackgroundImage.

What I would like to do is add a drop shadow to my non rectangle form. I did
a search on the Internet for how to add a drop shadow to a form, but that
only returned pages that showed how to change the ClassStyle of the form in
the overridden CreateParams procedure. This does add a drop down shadow to
the form, but it’s rectangular, and doesn’t go round the edge of my
non-rectangle form.

I’ve also tried to draw the shadow directly on the form using pen’s that
have a part transparent alpha value, but it just draws a solid line.

Can someone please show me how to add a drop shadow to a non-rectangle form
in C#. Or how to draw part transparent alpha value lines on a transparent
form where you can see what's underneath the form?

Thanks for your help.
 
G

Guest

Rather than setting a transparency (or in addition to, if the shape you want
isn't completely filled) you should set the Form's Region property to a
Region created to match the filled shape you want.
 
C

Chris Dunaway

Jeff said:
Another approach is to use the FormShaper component from
http://www.springsys.com

This component changes the form into real non-rectangular shape base on a
bitmap.

How is that different that using a bitmap and the TransparencyKey
property of the form?

Just curious
 
S

Stuart Nathan

This might be easier
Protected Overrides ReadOnly Property CreateParams() As
System.Windows.Forms.CreateParams
Get
Dim parameters As CreateParams = MyBase.CreateParams
parameters.ClassStyle = (parameters.ClassStyle Or &H20000)
Return parameters
End Get
End Property

This provides the windows shadow.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top