+ Reply to Thread
Results 1 to 5 of 5

Fading Form

  1. #1
    Forum Contributor
    Join Date
    03-09-2004
    Posts
    140

    Fading Form

    Is there a code that makes a form invisible while making it transparent slowly..............?

    And :

    A code for Fading/Changing Colors on Form.............?
    Yours
    hesham Almakki
    http://www.almakki.com.ly/

  2. #2
    Norman Jones
    Guest

    Re: Fading Form

    Hi Helmekki,

    See xlDynamic at:

    http://www.xldynamic.com/source/xld.xlFAQ0007.html


    ---
    Regards,
    Norman


    "helmekki" <helmekki.1yikzm_1132017901.6905@excelforum-nospam.com> wrote in
    message news:helmekki.1yikzm_1132017901.6905@excelforum-nospam.com...
    >
    > Is there a code that makes a form invisible while making it transparent
    > slowly..............?
    >
    > And :
    >
    > A code for Fading/Changing Colors on Form.............?
    >
    >
    > --
    > helmekki
    >
    >
    > ------------------------------------------------------------------------
    > helmekki's Profile:
    > http://www.excelforum.com/member.php...fo&userid=6939
    > View this thread: http://www.excelforum.com/showthread...hreadid=485054
    >




  3. #3
    Jim Rech
    Guest

    Re: Fading Form

    I don't think think Norman's link shows actual fading. Here's how you do
    it:

    In the userform's module:

    Private Sub UserForm_Initialize()
    hWndDirects = 0
    End Sub

    Private Sub CommandButton1_Click()
    Dim Counter As Integer
    Dim Counter2 As Long
    For Counter = 255 To 1 Step -1
    SetUFOpacity Me, CByte(Counter)
    For Counter2 = 1 To 500 ''Delay loop
    DoEvents
    Next
    Next
    Unload Me
    End Sub


    And in a regular module:


    Declare Function FindWindow Lib "user32" Alias _
    "FindWindowA" (ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
    Declare Function GetWindowLong Lib "user32" Alias _
    "GetWindowLongA" (ByVal hWnd As Long, _
    ByVal nIndex As Long) As Long
    Declare Function SetWindowLong Lib "user32" Alias _
    "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
    ByVal dwNewLong As Long) As Long
    Declare Function SetLayeredWindowAttributes Lib "user32" _
    (ByVal hWnd As Long, ByVal crey As Byte, _
    ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

    Const GWL_EXSTYLE = (-20)
    Const WS_EX_LAYERED = &H80000
    Const LWA_ALPHA = &H2&

    Public hWndDirects As Long

    Sub SetUFOpacity(Frm As UserForm, Alpha As Byte)
    With Frm
    If hWndDirects = 0 Then
    hWndDirects = FindWindow("ThunderDFrame", .Caption)
    SetWindowLong hWndDirects, GWL_EXSTYLE, _
    GetWindowLong(hWndDirects, GWL_EXSTYLE) Or WS_EX_LAYERED
    End If
    SetLayeredWindowAttributes hWndDirects, 0, Alpha, LWA_ALPHA
    End With
    End Sub


    --
    Jim
    "helmekki" <helmekki.1yikzm_1132017901.6905@excelforum-nospam.com> wrote in
    message news:helmekki.1yikzm_1132017901.6905@excelforum-nospam.com...
    |
    | Is there a code that makes a form invisible while making it transparent
    | slowly..............?
    |
    | And :
    |
    | A code for Fading/Changing Colors on Form.............?
    |
    |
    | --
    | helmekki
    |
    |
    | ------------------------------------------------------------------------
    | helmekki's Profile:
    http://www.excelforum.com/member.php...fo&userid=6939
    | View this thread: http://www.excelforum.com/showthread...hreadid=485054
    |



  4. #4
    Peter T
    Guest

    Re: Fading Form

    For any W98 users-

    The SetLayeredWindowAttributes API was introduced in W2000, trying to call
    it in W98 would not only crash XL but probably windows.

    Regards,
    Peter T



    "Jim Rech" <jrrech@hotmail.com> wrote in message
    news:eaRiZme6FHA.2676@TK2MSFTNGP15.phx.gbl...
    > I don't think think Norman's link shows actual fading. Here's how you do
    > it:
    >
    > In the userform's module:
    >
    > Private Sub UserForm_Initialize()
    > hWndDirects = 0
    > End Sub
    >
    > Private Sub CommandButton1_Click()
    > Dim Counter As Integer
    > Dim Counter2 As Long
    > For Counter = 255 To 1 Step -1
    > SetUFOpacity Me, CByte(Counter)
    > For Counter2 = 1 To 500 ''Delay loop
    > DoEvents
    > Next
    > Next
    > Unload Me
    > End Sub
    >
    >
    > And in a regular module:
    >
    >
    > Declare Function FindWindow Lib "user32" Alias _
    > "FindWindowA" (ByVal lpClassName As String, _
    > ByVal lpWindowName As String) As Long
    > Declare Function GetWindowLong Lib "user32" Alias _
    > "GetWindowLongA" (ByVal hWnd As Long, _
    > ByVal nIndex As Long) As Long
    > Declare Function SetWindowLong Lib "user32" Alias _
    > "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
    > ByVal dwNewLong As Long) As Long
    > Declare Function SetLayeredWindowAttributes Lib "user32" _
    > (ByVal hWnd As Long, ByVal crey As Byte, _
    > ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
    >
    > Const GWL_EXSTYLE = (-20)
    > Const WS_EX_LAYERED = &H80000
    > Const LWA_ALPHA = &H2&
    >
    > Public hWndDirects As Long
    >
    > Sub SetUFOpacity(Frm As UserForm, Alpha As Byte)
    > With Frm
    > If hWndDirects = 0 Then
    > hWndDirects = FindWindow("ThunderDFrame", .Caption)
    > SetWindowLong hWndDirects, GWL_EXSTYLE, _
    > GetWindowLong(hWndDirects, GWL_EXSTYLE) Or WS_EX_LAYERED
    > End If
    > SetLayeredWindowAttributes hWndDirects, 0, Alpha, LWA_ALPHA
    > End With
    > End Sub
    >
    >
    > --
    > Jim
    > "helmekki" <helmekki.1yikzm_1132017901.6905@excelforum-nospam.com> wrote

    in
    > message news:helmekki.1yikzm_1132017901.6905@excelforum-nospam.com...
    > |
    > | Is there a code that makes a form invisible while making it transparent
    > | slowly..............?
    > |
    > | And :
    > |
    > | A code for Fading/Changing Colors on Form.............?
    > |
    > |
    > | --
    > | helmekki
    > |
    > |
    > | ------------------------------------------------------------------------
    > | helmekki's Profile:
    > http://www.excelforum.com/member.php...fo&userid=6939
    > | View this thread:

    http://www.excelforum.com/showthread...hreadid=485054
    > |
    >
    >




  5. #5
    Norman Jones
    Guest

    Re: Fading Form

    Hi Jim,

    Thank you for the correction.

    I thought that the xlDynamic site had a downloadable example of a fading
    form, but I can no longer find it

    In any event, the link I gave relates to a timed splash screen without the
    rquired fade.

    Thank you also for your code.

    ---
    Regards,
    Norman



    "Jim Rech" <jrrech@hotmail.com> wrote in message
    news:eaRiZme6FHA.2676@TK2MSFTNGP15.phx.gbl...
    >I don't think think Norman's link shows actual fading. Here's how you do
    > it:
    >
    > In the userform's module:
    >
    > Private Sub UserForm_Initialize()
    > hWndDirects = 0
    > End Sub
    >
    > Private Sub CommandButton1_Click()
    > Dim Counter As Integer
    > Dim Counter2 As Long
    > For Counter = 255 To 1 Step -1
    > SetUFOpacity Me, CByte(Counter)
    > For Counter2 = 1 To 500 ''Delay loop
    > DoEvents
    > Next
    > Next
    > Unload Me
    > End Sub
    >
    >
    > And in a regular module:
    >
    >
    > Declare Function FindWindow Lib "user32" Alias _
    > "FindWindowA" (ByVal lpClassName As String, _
    > ByVal lpWindowName As String) As Long
    > Declare Function GetWindowLong Lib "user32" Alias _
    > "GetWindowLongA" (ByVal hWnd As Long, _
    > ByVal nIndex As Long) As Long
    > Declare Function SetWindowLong Lib "user32" Alias _
    > "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
    > ByVal dwNewLong As Long) As Long
    > Declare Function SetLayeredWindowAttributes Lib "user32" _
    > (ByVal hWnd As Long, ByVal crey As Byte, _
    > ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
    >
    > Const GWL_EXSTYLE = (-20)
    > Const WS_EX_LAYERED = &H80000
    > Const LWA_ALPHA = &H2&
    >
    > Public hWndDirects As Long
    >
    > Sub SetUFOpacity(Frm As UserForm, Alpha As Byte)
    > With Frm
    > If hWndDirects = 0 Then
    > hWndDirects = FindWindow("ThunderDFrame", .Caption)
    > SetWindowLong hWndDirects, GWL_EXSTYLE, _
    > GetWindowLong(hWndDirects, GWL_EXSTYLE) Or WS_EX_LAYERED
    > End If
    > SetLayeredWindowAttributes hWndDirects, 0, Alpha, LWA_ALPHA
    > End With
    > End Sub
    >
    >
    > --
    > Jim




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1