4个回答
展开全部
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
Const GW_HWNDNEXT = 2
下面的函数是设置透明度的函数,说明如下:
seevalue在0-255,但是,数值好像最好在20及以上。数值在5及以下则对窗体的点击无效
hwd为想要设置为透明的窗体的句柄。比如,我想让当前窗体很透明,
我就会写:Call TransParent(25,Me.hWnd )
函数代码:
Function TransParent(ByVal seevalue As Integer, ByVal hwd As Long)
Dim rtn As Long
rtn = GetWindowLong(hwd, (-20))
rtn = rtn Or &H80000
SetWindowLong hwd, (-20), rtn
SetLayeredWindowAttributes hwd, 0, seevalue, &H2
End Function
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
Const GW_HWNDNEXT = 2
下面的函数是设置透明度的函数,说明如下:
seevalue在0-255,但是,数值好像最好在20及以上。数值在5及以下则对窗体的点击无效
hwd为想要设置为透明的窗体的句柄。比如,我想让当前窗体很透明,
我就会写:Call TransParent(25,Me.hWnd )
函数代码:
Function TransParent(ByVal seevalue As Integer, ByVal hwd As Long)
Dim rtn As Long
rtn = GetWindowLong(hwd, (-20))
rtn = rtn Or &H80000
SetWindowLong hwd, (-20), rtn
SetLayeredWindowAttributes hwd, 0, seevalue, &H2
End Function
展开全部
窗体好像不能设为透明吧,只有label和shape才有这个属性
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
改学VB.NET吧,其可以直接在属性中设定,VB6只能用API了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
擦,窗体透明??不会吧。。有些控件行
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询