制造出透明的窗体(Form)

2008-02-23 06:57:46来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

注释:form上有Command1, command2两个Button并事先设定form之BorderStyle = 0

Option Explicit
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
Const GWL_EXSTYLE = (-20)
Const WS_EX_TRANSPARENT = &H20&
Private PreValue As Long

Private Sub Command2_Click() 注释:还原变成不透明
Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, PreValue)
Me.Hide
Me.Show
End Sub

Private Sub Form_Load()
Dim i As Long

i = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
注释:变成透明的Form
PreValue = SetWindowLong(Me.hwnd, GWL_EXSTYLE, i Or WS_EX_TRANSPARENT)
Me.Show
DoEvents
Command1.Refresh 注释:令Command1可见
Command2.Refresh 注释:令Command2可见
End Sub

上一篇: 透明的窗体(From)上显示背景透通图
下一篇: 椭圆形的窗体

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:为什么用VB开发数据库---VB数据库入门之(一)

下一篇:用VB编写调色板