手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

VB如何实现透明效果

时间:2024-10-11 20:15:56

1、新建EXE。

VB如何实现透明效果

2、代码如图。下一页有文字版。

VB如何实现透明效果

3、在通用里面输入这些。注意是 (通用)Private Declare Functio艘绒庳焰n GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As LongPrivate Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPrivate Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As LongPrivate Const WS_EX_LAYERED = &H80000Private Const GWL_EXSTYLE = (-20)Private Const LWA_ALPHA = &H2Private Const LWA_COLORKEY = &H1

VB如何实现透明效果

4、在FORM里输这个。注意格式。Private Sub Form_Load() Me.BackColor = &HFF0101 Dim rtn As Long rtn = GetWindowLong(Me.hwnd, GWL_EXSTYLE) rtn = rtn Or WS_EX_LAYERED SetWindowLong Me.hwnd, GWL_EXSTYLE, rtn SetLayeredWindowAttributes Me.hwnd, &HFF0101, 0, LWA_COLORKEYEnd Sub

VB如何实现透明效果

5、展示一下效果。

VB如何实现透明效果

6、注意!控件不透明!

VB如何实现透明效果
© 手抄报圈