关于VB窗体透明的问题

这是窗体透明的代码,有一个问题是,黑色不能完全去掉,请看图片'+++++++++++++++++++++++++形状窗体(函数声明)+++++++++++++++Priv... 这是窗体透明的代码,有一个问题是,黑色不能完全去掉,请看图片
'+++++++++++++++++++++++++形状窗体(函数声明)+++++++++++++++
Private Declare Function SetWindowPos Lib "user32" ( _
ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST = -1
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 GetCursorPos Lib "user32" ( _
lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
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 Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_COLORKEY = &H1
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Const LWA_ALPHA = &H2

'++++++++++++++++++++++++++子程序++++++++++++++++++++++++
Private Sub Form_Load()
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
Me.BackColor = RGB(0, 0, 0)
proper = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
proper = proper Or WS_EX_LAYERED
SetWindowLong Me.hwnd, GWL_EXSTYLE, proper
SetLayeredWindowAttributes Me.hwnd, RGB(0, 0, 0), 100, LWA_COLORKEY
End Sub
展开
 我来答
百度网友5740f6d
2012-06-03 · 超过47用户采纳过TA的回答
知道小有建树答主
回答量:105
采纳率:100%
帮助的人:77.7万
展开全部
第一点把Form 的BoderStyle设为0这样就没有窗口了,第二,你那个所谓的黑色是看似近似于黑色,并非纯黑色。这是因为你往窗体上给制的是有Alpha的图像。你若是不绘制图像就会只看到一个空的透明的窗口
风雪剑无痕
2012-05-31 · TA获得超过1253个赞
知道大有可为答主
回答量:1691
采纳率:100%
帮助的人:1682万
展开全部
估计和窗体的东东有关,代码是正常的
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式