William Hindman
wdhindman at bellsouth.net
Thu Apr 15 22:41:07 CDT 2004
Chris ...I use a some animated forms to make users pay attention but I've never faded one in or out. ...however, I do have in my code library some code that was posted here about three years ago that supposedly came from MS ...I've never got around to trying it but I'll repost it below and maybe it will give you what you need: __________________________________________________________ This type simple adjusts the colour slowly while reducing the form's width and height down to 0 before unloading the form. This is all done through a for-next loop. (form should be set to auto-center.) The preferred method is to adjust the current forms transparency from solid to invisible before unloading the same. Here is a copy of the code from MS technical help. 'In a module... Option Explicit Private Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias _ "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" _ (ByVal hwnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, _ ByVal dwFlags As Long) As Long private Const GWL_EXSTYLE = (-20) Private Const WS_EX_LAYERED = &H80000 Private Const WS_EX_TRANSPARENT = &H20& Private Const LWA_ALPHA = &H2& public sub Transparentcy(bTrans as byte, frmWhatever as form) Dim lOldStyle As Long with frmWhatever lOldStyle = GetWindowLong(.hwnd, GWL_EXSTYLE) SetWindowLong .hwnd, GWL_EXSTYLE, lOldStyle Or WS_EX_LAYERED SetLayeredWindowAttributes .hwnd, 0, bTrans, LWA_ALPHA end with end sub 'In your form... something like this. (haven't tested.) Private Sub Form_UnLoad() dim i as byte for i = 255 to 1 step -5 Transparentcy i, me next End Sub The above code work great but you have to have the latest copy of the User32.dll. Greater than 4.0 _________________________________________________________ ...hth ...and if you do make it work, I'd certainly like to see a sample mdb posted. William Hindman "Always code as if the person who is maintaining or testing your code is a violent psychopath who knows where you live." William Silverstein ----- Original Message ----- From: "Christopher Hawkins" <clh at christopherhawkins.com> To: <accessd at databaseadvisors.com> Sent: Thursday, April 15, 2004 8:26 PM Subject: [AccessD] A2K/03/XP: Make a form "dissolve" into view? > OK, here's a weird one. > > I'm doing fit and polish work on one of my projects. I thought of > something that might be fun to code, seeing as I'm ahead of schedule. > > > It would be a nice bit of eye candy to have the splash screen > dissolve or fade into view instead of just popping open as Access/VB > forms tend to do. In essence, the form would open with 100% > transparency and incrementally decrease transparency until it was a > solid form. The whole fade (actually, it's the opposite of fade, > what do you call that?) should only take a second or two. > > Has anyone ever done anything like this in Access? I've seen VB apps > that do this, but never an app I was able to get the source to, so I > don't even know where to start. > > -Christopher- > > > > > -- > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >