Advertisement
4_2005-2006 Custom Controls/ Forms/ Menus #167748

Semi transparent form 2000/XP

Your standard semi transparent form in Win 2000/XP without the flickering. Comes with fade-in effect.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Private Sub Form_Load()
 Trans Me.hwnd, 1, 85
End Sub
Private Sub Trans(lngHwnd As Long, _
     Optional ByVal Speed As Byte = 1, _
     Optional ByVal OpaquePercent As Byte = 85)
Dim Cnt As Long
 On Error Resume Next
 'Layered window
 SetWindowLong lngHwnd, GWL_EXSTYLE, GetWindowLong(lngHwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
 SetLayeredWindowAttributes lngHwnd, 0, 0, LWA_ALPHA
 'Smoothness
 ShowWindow lngHwnd, SW_SHOW
 RedrawWindow lngHwnd, ByVal 0&, ByVal 0&, RDW_UPDATENOW
 'Fade-in effect
 'OpaquePercent range = 0 to 100 [Default = 85]
 'Speed range = 0 to about 5 [Default = 1] (visible difference not much for higher values)
 For Cnt = 0 To OpaquePercent Step Speed
  SetLayeredWindowAttributes lngHwnd, 0, (Cnt / 100) * 255, LWA_ALPHA
 Next Cnt
End Sub
Original Comments (3)
Recovered from Wayback Machine