SKY外语计算机学习

标题: Shape1和一个Picture1透明 [打印本页]

作者: SKY定格    时间: 2012-5-14 20:03
标题: Shape1和一个Picture1透明
本帖最后由 sky_yx 于 2015-12-30 14:22 编辑

  1. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
  2. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  3. Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
  4. Const WS_EX_LAYERED = &H80000
  5. Const GWL_EXSTYLE = (-20)
  6. Const LWA_COLORKEY = &H1
  7. Dim rtn&
  8. Private Sub Form_Load()
  9. Picture1.BackColor = RGB(66, 66, 66)
  10. Shape1.BackColor = RGB(66, 66, 66)
  11. rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
  12. rtn = rtn Or WS_EX_LAYERED
  13. SetWindowLong hwnd, GWL_EXSTYLE, rtn
  14. SetLayeredWindowAttributes hwnd, RGB(66, 66, 66), &H2, LWA_COLORKEY
  15. End Sub
复制代码







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