![]() |
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.............? -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=485054 |
Fading Form
Hi Helmekki,
See xlDynamic at: http://www.xldynamic.com/source/xld.xlFAQ0007.html --- Regards, Norman "helmekki" wrote in message ... 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 |
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" wrote in message ... | | 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 | |
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" wrote in message ... 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" wrote in message ... | | 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 | |
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" wrote in message ... 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 |
All times are GMT +1. The time now is 12:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com