PDA

View Full Version : مقاله: ساختن فرم شیشه ای !!



MBG73
شنبه 29 فروردین 1388, 16:08 عصر
ساختن فرم شیشه ای :


Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Declare Function setlayeredwindowattributes Lib "use32" (ByVal hwnd As Long, ByVal crkey As Long, ByVal balpha As Byte, ByVal dwflags As Long) As Long

Private Const GWL_EXSTYLE = (-20)
Private Const lwa_alpha = &H2
Private Const ws_ex_layered = &H80000
Public Function trans(ByVal hwnd As Long, perc As Integer) As Long
Dim msg As Long
On Error Resume Next
If perc < 0 Or perc > 255 Then
trans = 1
Else
msg = GetWindowLong(hwnd, GWL_EXSTYLE)
msg = msg Or ws_ex_layered
SetWindowLong hwnd, GWL_EXSTYLE, msg
setlayeredwindowattributes hwnd, 0, perc, lwa_alpha
trans = 0
End If
If Err Then
trans = 2
End If
End Function

Private Sub Form_Activate()
trans Me.hwnd, 10#
End Sub