Results 1 to 14 of 14

Thread: Form Fade-In...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    95

    Question

    Hi guys,
    How can I make my form fade-in each time it loads up?
    Can someone give me a source code?

    The fade-in should be a fade in that you can see the background until the form is fully loaded just like in ActiveSplash.


    Thanks!

  2. #2
    Addicted Member Rudy's Avatar
    Join Date
    Sep 2000
    Location
    BC, Canada
    Posts
    198
    im not sure but i "think" u can only do that in windows 2000 as i said im NOT SURE
    *Rudy^
    Visual Studio 6 Ent. SP5
    Windows 2000 SP4
    Windows XP SP1a

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Not a fade but a nice in and out.

    Code:
    'implore or explode a form on open or close
    'bas module code
    
    Option Explicit
    
    #If Win16 Then
        Type RECT
            Left As Integer
            Top As Integer
            Right As Integer
            Bottom As Integer
        End Type
    #Else
        Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
        End Type
    #End If
    
    'User and GDI Functions for Explode/Implode to work
    
    #If Win16 Then
        Declare Sub GetWindowRect Lib "User" (ByVal hwnd As Integer, lpRect As RECT)
        Declare Function GetDC Lib "User" (ByVal hwnd As Integer) As Integer
        Declare Function ReleaseDC Lib "User" (ByVal hwnd As Integer, ByVal hdc As Integer) As Integer
        Declare Sub SetBkColor Lib "GDI" (ByVal hdc As Integer, ByVal crColor As Long)
        Declare Sub Rectangle Lib "GDI" (ByVal hdc As Integer, ByVal X1 As Integer, ByVal Y1 As Integer, ByVal X2 As Integer, ByVal Y2 As Integer)
        Declare Function CreateSolidBrush Lib "GDI" (ByVal crColor As Long) As Integer
        Declare Function SelectObject Lib "GDI" (ByVal hdc As Integer, ByVal hObject As Integer) As Integer
        Declare Sub DeleteObject Lib "GDI" (ByVal hObject As Integer)
    #Else
        Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
        Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
        Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
        Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
        Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
        Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
        Declare Function SelectObject Lib "user32" (ByVal hdc As Long, ByVal hObject As Long) As Long
        Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
    #End If
    
    
    
    Sub ExplodeForm(f As Form, Movement As Integer)
        Dim myRect As RECT
        Dim formWidth%, formHeight%, i%, X%, Y%, Cx%, Cy%
        Dim TheScreen As Long
        Dim Brush As Long
        
        GetWindowRect f.hwnd, myRect
        formWidth = (myRect.Right - myRect.Left)
        formHeight = myRect.Bottom - myRect.Top
        TheScreen = GetDC(0)
        Brush = CreateSolidBrush(f.BackColor)
        
        For i = 1 To Movement
            Cx = formWidth * (i / Movement)
            Cy = formHeight * (i / Movement)
            X = myRect.Left + (formWidth - Cx) / 2
            Y = myRect.Top + (formHeight - Cy) / 2
            Rectangle TheScreen, X, Y, X + Cx, Y + Cy
        Next i
        
        X = ReleaseDC(0, TheScreen)
        DeleteObject (Brush)
        
    End Sub
    
    
    Public Sub ImplodeForm(f As Form, Direction As Integer, Movement As Integer, ModalState As Integer)
    
        
        Dim myRect As RECT
        Dim formWidth%, formHeight%, i%, X%, Y%, Cx%, Cy%
        Dim TheScreen As Long
        Dim Brush As Long
        
        GetWindowRect f.hwnd, myRect
        formWidth = (myRect.Right - myRect.Left)
        formHeight = myRect.Bottom - myRect.Top
        TheScreen = GetDC(0)
        Brush = CreateSolidBrush(f.BackColor)
        
            For i = Movement To 1 Step -1
            Cx = formWidth * (i / Movement)
            Cy = formHeight * (i / Movement)
            X = myRect.Left + (formWidth - Cx) / 2
            Y = myRect.Top + (formHeight - Cy) / 2
            Rectangle TheScreen, X, Y, X + Cx, Y + Cy
        Next i
        
        X = ReleaseDC(0, TheScreen)
        DeleteObject (Brush)
            
    End Sub
    
    '<<<<<<<<<<<<<<<  Form Code  >>>>>>>>>>>>>>>>>>>>>>
    
    'unload event
    
        Call ImplodeForm(Me, 2, 500, 1)
        Set Form1 = Nothing
        unload me	
    
    
    'load event
    	Call ExplodeForm(Me, 500)

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    Hi HeSaidJoe, with more than 2000 threads, why aren't you a guru?

  5. #5
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    because I'm <?>


    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  6. #6
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Fade in + out and more!!!

    Code:
    Const AW_HOR_POSITIVE = &H1 'Animates the window from left to right. This flag can be used with roll or slide animation.
    Const AW_HOR_NEGATIVE = &H2 'Animates the window from right to left. This flag can be used with roll or slide animation.
    Const AW_VER_POSITIVE = &H4 'Animates the window from top to bottom. This flag can be used with roll or slide animation.
    Const AW_VER_NEGATIVE = &H8 'Animates the window from bottom to top. This flag can be used with roll or slide animation.
    Const AW_CENTER = &H10 'Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
    Const AW_HIDE = &H10000 'Hides the window. By default, the window is shown.
    Const AW_ACTIVATE = &H20000 'Activates the window.
    Const AW_SLIDE = &H40000 'Uses slide animation. By default, roll animation is used.
    Const AW_BLEND = &H80000 'Uses a fade effect. This flag can be used only if hwnd is a top-level window.
    Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Boolean
    Private Sub Form_Load()
        'KPD-Team 1999
        'URL: http://www.allapi.net/
        'E-Mail: KPDTeam@Allapi.net
        'Set the graphic mode to persistent
        Me.AutoRedraw = True
        Me.Print "Unload me"
        'Animate the window (faded)
        AnimateWindow Me.hwnd, 200, AW_BLEND
    End Sub
    Is supposed to work for win98 and 2k



    [Edited by Jop on 11-03-2000 at 01:39 PM]
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    95

    Thumbs up Thanks!

    Thanks man!
    you're great.

  8. #8
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    VB^ SP3 Win98...
    Just displays a title bar for me(sometimes).
    The form never makes it.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  9. #9
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    Unfortunately, this is not available in Windows95...
    There should be at least a patch ore something to obtain this nice effects with the older 95 version.
    The newer SystemParametersInfp API allows us to change these settings (like shadow mouse cursor in Windows 2K). I wonder if there should be any DLL available to achieve this in Win95...

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Posts
    95

    Angry it doesn't work for me..

    it doesn't work man...

  11. #11
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Anyone with win2k here? It isn't working for me neither, but the sliding effects are...
    It's supposed to work with win98 and win2k, but I have win98 and it indeed doesn't work...

    Let's test it on win2k.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  12. #12
    Hyperactive Member D12Bit's Avatar
    Join Date
    Oct 2000
    Location
    Guatemala
    Posts
    373

    Lightbulb Take a look at this

    http://msdn.microsoft.com/library/techart/layerwin.htm

    This is the document that explains the new capabilities of
    transparency that W2000 has, and Win98 should have but maybe
    is in Win98SE (Second Edition) without the BLEND (The actual
    fade parameter of AnimateWindow)

    Beside that if any one would like the source code to make a transparent form, just have to ask.

    You can send me an email for it and i will send you the complete project.

    I didn't make it i just download it from Planet-Source and
    the download name is: CODE_UPLOAD1062110122000.zip if you like to look for it by yourself

    d12bit@intelnet.net.gt


    Saludos...
    "Who Dares Wins" - "Quien se Arriesga Gana"
    Mail me at:

  13. #13
    Junior Member
    Join Date
    Oct 2000
    Posts
    16

    Talking Re: Take a look at this

    Originally posted by D12Bit
    http://msdn.microsoft.com/library/techart/layerwin.htm

    This is the document that explains the new capabilities of
    transparency that W2000 has, and Win98 should have but maybe
    is in Win98SE (Second Edition) without the BLEND (The actual
    fade parameter of AnimateWindow)

    Beside that if any one would like the source code to make a transparent form, just have to ask.

    You can send me an email for it and i will send you the complete project.

    I didn't make it i just download it from Planet-Source and
    the download name is: CODE_UPLOAD1062110122000.zip if you like to look for it by yourself

    d12bit@intelnet.net.gt


    Saludos...

    I ran across a program that actually has a transparent splash screen. The program is called Font FX put out by Electric Rain. If anyone gets a chance to down this app, the splash screen transparency is what I'm looking to do for my VB class project for the final Project. If anyone can help with this I would greatly appreciate it. If they can make it transparent so can we. HEHEHEHEHEHEHE!!!!!
    Free Your Creative Spirit
    -----------------------------------

  14. #14
    Junior Member
    Join Date
    Oct 2000
    Posts
    16

    Talking Transparent

    Thanx Jop
    Free Your Creative Spirit
    -----------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width