Form shadow

NigelShaw

Registered User.
Local time
Today, 22:58
Joined
Jan 11, 2008
Messages
1,575
Hi

Thanks to darbids icandy, I have managed to put a shadow on my form when the app window is minimized however, it's not a good shadow ( sorry darbid lol ). I was looking for a windows type shadow that is bigger and faded more like a proper good old fashioned drop shadow should be.

Any ideas if it can even be done?

Cheers

Nigel
 
I was looking for a windows type shadow that is bigger and faded more like a proper good old fashioned drop shadow should be.
Now I understand you. As far as I could see that IS the "M$ lazy Windows" shadow.

If you want anything better you will have to make it yourself. That would involve making a second bigger windows which would be your dropshadow and then making it the big daddy (but behind) to your Access form. I could not get it to work properly. My problem what getting them to come together with the form on top, but taking the size of the new shadow window.

All that I know is that you take a small image a couple of pixels big (grey helps) and you use that image as the window that you create with the Windows API. Then that will give your nice dropshadow.
 
Hi Darbid,

if i understand correctly then, it cant be done within an API or the like. to achieve ehat i want i have to physically make a shadow in something like illustrator and glue it to the side of the form????

its a shame access doesnt work in the same way as html that would let us use CSS to do this. Seems that Access is made for developers but they've held back everything nice about presentation.. doesnt make much sense to be honest



regs


Nidge
 
if i understand correctly then, it cant be done within an API or the like. to achieve ehat i want i have to physically make a shadow in something like illustrator and glue it to the side of the form????

Yes and No - I am sure it is possible - I have just not got it. The steps would be something like this - ALL windows API calls

1. Get handle to your MSAccess Form
2. Get a small bitmap image
3. Create new window make it about 25 pixels wider and higher than Access window.
4. Set bitmap to this new window (this stretches the little bitmap out and thus give a good blur
5. Then put the two windows together, with your msaccess form at the front and your blur window behind it.
Sounds easy :-)

its a shame access doesnt work in the same way as html that would let us use CSS to do this. Seems that Access is made for developers but they've held back everything nice about presentation.. doesnt make much sense to be honest
Nidge
I am still in the dark ages with 2003 - maybe 2007 and 2010 is better - SURELY 2010 can handle Alpha transparency and maybe 2007 could too.

I would suggest you try this -

Make a form in your favourite design program adobe, paint etc with a drop shadow. Save it as a png. Then add it to a MS Access form. Then make the MSaccess form transparent leaving your picture form with a shadow.

Making a form transparent is not that hard have a look at my code where I fade the forms in and out. You can instead of choosing the whole form you can choose a colour which the WINDOWS API will make transparent. Make your form RGB 255,255,255 and then make this colour transparent. This might work on 2007/2010. It will not in 2003.
 
Re transparency this is the key first make the form layered but then this here

Code:
SetLayeredWindowAttributes hWnd, RGB(0, 0, 0), opacity, LWA_ALPHA

In that RBG if you make this a colour then every color on your form that matches this will have the OPACITY you give it. Try it out you can make great holes in your forms and you can see and click through them.
 
Hi

so here's an idea ( if i have it right)

1- make a form transparent with a png border which WONT be transparent.
2- on the transparent form, the png will be 3 parts. bottom, corner, side
3- allow the transparent form to pick up the size of the user form and add width & height to side & bottom ( same width as png border )
4- overlay user form on top of transparent form
5- end result is a form with a nice drop shadow...........


all easy to explain but i'll delve in to the actual workings lol


Nidge
 
Either I dont understand or you have got it wrong.

What you have suggeted sounds like a mix of both using the API and using pictures for your form.

The API method -

Design your MSAccess form (Form1) as per usual.
In the onLoad of this form you have to
On the fly use the windows API to create a window (window1).
Take a small 2 pixel x 2 pixel grey bitmap image and set it as Window1.
Marry Window1 and Form1 together. Window 1 must be bigger and a little to the right and down from Form1 so that you see the shadow.
I think Window1 is behind Form1 although technically I am not sure it might be that Window1 is infront of Form1 but where Form1 exists, Window1 is made transparent.

Workaround Hack - provided in 2007/2010 that it now allows for png with alpha transparency.

Design your MSAccess form (Form1) as per usual - all controls should be on a colour that you want your form to be. On the edges of your form make it a strange color like RED.
Add a png image as a boarder. On the inside of the image make it the form color. on the outside where it is RED you will have your shadow.
Then use the Windows API on the form to make RED transparent.
If it works you will see your form, the controls and the png borders. RED is made transparent and because your form colour and png border colour is identical you will not see any join.

This does not give much flexibility on sizing but it is just the prinicple i am trying to explain to you.
 
All seems too much trouble to be honest especially when other programs like Bento etc create then so so easily..

time to move on to Visual Studio i think.........




Nidge
 
Especially for what you are doing with a splash window a WPF form would be much better. You could create a WPF .dll which is COM exposed and registerable. This could pop up first pretty simply.


Anyway I have added an example of making parts of a form transparent. It might give you some other ideas.

Note how I can mask a hole in the corner and then make it dissappear.

The idea is you put your png image there with a drop shadow. The png stayes the colour is gone leaving you with a dropshadow.

it does not work in 2003 but might in 2007 and would have to in 2010.

I going to have a beer at Oktoberfest.
 

Attachments

Hello mate,

i'll look at the sample later thanks.

what is a WPF?

Enjoy Oktoberfest lol....





regs



Nidge
 

Users who are viewing this thread

Back
Top Bottom