Use VB to implement the same menu as QQ (translucent window)

Source: Internet
Author: User
Option Explicit

''' Window translucent Declaration starts
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
'''Window translucent declaration ends

Private sub form_load ()
''''' Window translucent code starts
Dim RTN as long
RTN = getwindowlong (hwnd, gwl_exstyle)
RTN = RTN or ws_ex_layered
Setwindowlong hwnd, gwl_exstyle, RTN
Setlayeredwindowattributes hwnd, 0,180, lwa_alpha 'transparency: 0-
''''' The window translucent code ends.
With Me
. Width = 1200 + 155
. Height = 4860 + 355
. Borderstyle = 3
. ScaleMode = 1
. BackColor = & H80C0FF
. FillStyle = 1
End

With Picture1
. Width = 1200 + 60
. Height = 4860
End
Dim I As Integer
For I = Command1.Count-1 To 0 Step-1
With Command1 (I)
. Width = 1200
. Height = 300
. Top = Picture1.ScaleHeight-300 * (Command1.Count-I)
. Left = 0
. Caption = "group" & I + 1
End
Next I
Command1 (0). Top = 0
End Sub

Private sub commandateclick (index as integer)
Picture1.setfocus
'Focus on picture1 to prevent the button from appearing in an ugly black box.
Dim I as integer
For I = 1 to index
Command1 (I). Top = 300 * I
Next I
For I = command1.count-1 to index + 1 step-1
Command1 (I). Top = picture1.scaleheight-300 * (command1.count-I)
Next I
End sub

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.