SKY外语计算机学习

标题: vb 让窗体半透 [打印本页]

作者: SKY定格    时间: 2012-5-14 20:06
标题: vb 让窗体半透
本帖最后由 sky_yx 于 2015-12-30 14:22 编辑
  1. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  2. Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
  3. Const WS_EX_LAYERED = &H80000
  4. Const GWL_EXSTYLE = (-20)
  5. Const LWA_ALPHA = &H2
  6. 'Const LWA_COLORKEY = &H1
  7. Private Sub Form_Load()
  8.      SetWindowLong Me.hwnd, GWL_EXSTYLE, WS_EX_LAYERED
  9.      SetLayeredWindowAttributes Me.hwnd, 0, 150, LWA_ALPHA  '150为透明度(0-255)
  10. End Sub
复制代码







欢迎光临 SKY外语计算机学习 (http://skywj.com/) Powered by Discuz! X2.5