用户登录  |  用户注册
首 页商业源码原创产品编程论坛
当前位置:PB创新网文章中心编程技巧VisualBasic

制造出透明的Form

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2009-03-16 19:48:39
注释: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

Tags:

作者:佚名

文章评论评论内容只代表网友观点,与本站立场无关!

   评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论

相关文章

PB创新网ourmis.com】Copyright © 2000-2009 . All Rights Reserved .
页面执行时间:7,625.00000 毫秒
Email:ourmis@126.com QQ:2322888 蜀ICP备05006790号