Form DropShadow

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts Page 1 of 1
Contributors
User avatar
mikethedj4
VIP - Site Partner
VIP - Site Partner
Posts: 2592
Joined: Thu Mar 25, 2010 4:36 am

Form DropShadow
mikethedj4
I know this is possible, but I was wondering, how do you add a dropshadow to a form???
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

Re: Form DropShadow
CodenStuff
Hello,

I think to do this it would be better to have a second form open behind your main form and set it slightly off-center so it looks like a shadow and have it move when you move the main form.

But you can try this code which works on XP but not guaranteed to work on Vista/7. Just add it at the very top of your code after "Public Class From..":
Code: Select all
Private Const CS_DROPSHADOW As Integer = 131072
    Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
        Get
            Dim Shadow As CreateParams = MyBase.CreateParams
            Shadow.ClassStyle = Shadow.ClassStyle Or CS_DROPSHADOW
            Return Shadow
        End Get
    End Property
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
mikethedj4
VIP - Site Partner
VIP - Site Partner
Posts: 2592
Joined: Thu Mar 25, 2010 4:36 am

Re: Form DropShadow
mikethedj4
I tried that before, and it didn't seem to work with my app, or even a new app with nothing on it, but a button with a messagebox.
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

Re: Form DropShadow
CodenStuff
Hello,

Do you have the shadow effects switched on in your display settings?

Right-click on desktop > Properties > Appearance > Effects ..then click "Show shadows under menus"

If that option isnt selected then it wont work.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
mikethedj4
VIP - Site Partner
VIP - Site Partner
Posts: 2592
Joined: Thu Mar 25, 2010 4:36 am

Re: Form DropShadow
mikethedj4
That was why it didn't work lol. At least I learned another new thing, which makes this all worth while.
5 posts Page 1 of 1
Return to “Tutorial Requests”