注册 登录
编程论坛 VB6论坛

我弄了个窗体透明,但是会穿透的,请大神看下怎么使窗体透明而又不穿透。

mrye 发布于 2013-03-24 15:20, 568 次点击
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 "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long



Private Sub Form_Load()

Me.BackColor = &HF0000

Dim r As Long

BorderStyler = 0

r = GetWindowLong(hwnd, -20)

r = r Or &H80000

SetWindowLong hwnd, -20, r

SetLayeredWindowAttributes hwnd, &HFF0000, 0, &H1
3 回复
#2
seafish0112013-03-24 16:26
既然是透明的,那就摸不着的。除非你是半透明的
#3
lowxiong2013-03-25 18:13
SetLayeredWindowAttributes hwnd, &HFF0000, 0, &H1
改为
SetLayeredWindowAttributes hwnd, 0,100, &H2
#4
mrye2013-03-29 11:51
回复 3楼 lowxiong
谢谢斑竹了
1