Tải bản đầy đủ (.docx) (1 trang)

Các chiêu thức trong lập trình Để chương trình bạn có giao diện “Nữa trong suốt”

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (66.33 KB, 1 trang )

Để chương trình bạn có giao diện “Nữa trong suốt” home
Giới thiệu : Trong các Độc chiêu trước tôi đã có giới thiệu 2 chiêu khá hay đó là Form trong suốt và
Form theo hình dạng bức ảnh tuy nhiên mỗi chiêu có một vẽ hay, cũng như vậy tại độc chiêu này
tuy thực tế ứng dụng hầu như không gặp (Theo tôi nhận thấy) tuy nhiên nó cũng khá thú vị để ta
ngâm kíu.
Xuất xứ : www.pscode.com (Dungcoi lam nhiêm vụ “Thu gọn đọan Code)
Binh khí sử dụng : Không
Đoạn mã :
Option Explicit
Private Const ULW_COLORKEY = &H1
Private Const GWL_STYLE = (-16)
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
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 GetWindowLong Lib "user32" Alias "GetWindowLongA"
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal
hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As
Long) As Long
Dim Trans As Boolean
Dim OldStyle As Long
Private Sub Form_Load()
Transparent (True)
End Sub
Private Sub Transparent(t As Boolean)
Trans = Not Trans
If t Then
Me.BackColor = &HFFCCCC
SetWindowLong Me.hwnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes Me.hwnd, &HFFCCCC, 0, ULW_COLORKEY


Else
Me.BackColor = &H8000000F
SetWindowLong Me.hwnd, GWL_EXSTYLE, OldStyle
End If
End Sub

×