۰۵-دى-۱۳۹۱, ۱۵:۲۳:۵۲
برای ایجاد فرم شیشه ای یا همون ترانسپرنت کد زیر رو داخل یک ماژول ذخیره کنید و از اون داخل برنامتون استفاده کنید
کد:
Public Const WS_EX_LAYERED As Long = &H80000
Public Const LWA_ALPHA As Long = &H2
Public Const GWL_EXSTYLE = (-20)
Public Const RDW_INVALIDATE = &H1
Public Const RDW_ERASE = &H4
Public Const RDW_ALLCHILDREN = &H80
Public Const RDW_FRAME = &H400
Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Long, ByVal dwFlags As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function RedrawWindow2 Lib "user32" Alias "RedrawWindow" (ByVal hwnd As Long, ByVal lprcUpdate As Long, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long
Private Type OSVersionInfo
OSVSize As Long
dwVerMajor As Long
dwVerMinor As Long
dwBuildNumber As Long
PlatformID As Long
szCSDVersion As String * 128
End Type
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
(lpVersionInformation As OSVersionInfo) As Long
Sub Make_Transparent(lHwnd As Long, Porcentaje As Integer)
On Error GoTo Hell
Dim OSV As OSVersionInfo
OSV.OSVSize = Len(OSV)
If GetVersionEx(OSV) <> 1 Then Exit Sub
If OSV.PlatformID = 1 And OSV.dwVerMinor >= 10 Then Exit Sub
If OSV.PlatformID = 2 And OSV.dwVerMajor >= 5 Then
Call SetWindowLong(lHwnd, GWL_EXSTYLE, GetWindowLong(lHwnd, GWL_EXSTYLE) Or WS_EX_LAYERED)
Call SetLayeredWindowAttributes(lHwnd, 0, (Porcentaje * 255) / 100, LWA_ALPHA)
End If
Exit Sub
Hell:
End Sub