永发信息网

VB窗体透明的问题

答案:2  悬赏:0  手机版
解决时间 2021-04-16 08:18
  • 提问者网友:浮克旳回音
  • 2021-04-16 00:11
要求:把窗体透明了,但窗体上的控件还能看见。如果能把程序发到我的邮箱里,给加分!
最佳答案
  • 五星知识达人网友:詩光轨車
  • 2021-04-16 01:48

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 Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1


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 Const SWP_NOMOVE = &H2
Private Const SWP_NosIZE = &H1
''''''''''''''''''''''''''''''''''''''
Private Sub Form_Load()
Me.BackColor = RGB(88, 88, 88)

SetWindowPos Me.hwnd, HWND_TOPMosT, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NosIZE
Dim rtn As Long
BorderStyler = 0
rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED

SetWindowLong hwnd, GWL_EXSTYLE, rtn

SetLayeredWindowAttributes hwnd, RGB(88, 88, 88), 0, LWA_COLORKEY
End Sub

全部回答
  • 1楼网友:怀裏藏嬌
  • 2021-04-16 03:23
用易语言会不过也是API
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯