VB实现窗体淡入淡出
来源:互联网 发布:新开淘宝店如何运营 编辑:程序博客网 时间:2024/05/16 06:18
添加模块,代码如下
Option Explicit
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1
Private Const GWL_EXSTYLE = -20
Private Const WS_EX_LAYERED = &H80000
Public Sub setfrm(frm As Form, ByVal limpid As Long) ' 设置窗体透明度
Call SetWindowLong(frm.hWnd, GWL_EXSTYLE, GetWindowLong(frm.hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED)
Call SetLayeredWindowAttributes(frm.hWnd, 0, limpid, LWA_ALPHA) 'limpid在0--255之间
End Sub
========
窗体级变量
Option Explicit
Dim showfrm As Boolean
Dim i As Integer
Dim closefrm As Boolean
窗体登陆事件
Private Sub Form_Load()
Call setfrm(Me, 0)
showfrm = True
End Sub
窗体卸载事件
Private Sub Form_Unload(Cancel As Integer)
If closefrm = True Then Exit Sub
Cancel = 1
showfrm = False
Timer1.Enabled = True
End Sub
timer事件
Private Sub Timer1_Timer()
If showfrm Then
i = i + 3
If i >= 255 Then
i = 255
Timer1.Enabled = False
End If
Else
i = i - 2
If i <= 0 Then
i = 0
closefrm = True
Call talkewithme
Unload Me
Exit Sub
Timer1.Enabled = False
End If
End If
setfrm Me, i
End Sub
- VB实现窗体淡入淡出
- Winform窗体淡入淡出效果实现
- 实现窗体淡入淡出的完整代码
- VB6中实现窗体淡入淡出
- 实现窗体淡入淡出的完整代码
- C#实现窗体的淡入淡出效果
- C#窗体实现淡入淡出效果
- C# 实现窗体的淡入淡出效果
- C#淡出淡入窗体
- 淡出淡入窗体
- C#淡出淡入窗体
- 窗体淡入淡出效果
- 窗体的淡入淡出
- 窗体淡入淡出效果
- 使用C#实现Form窗体的淡入淡出效果
- winform实现淡入淡出,窗体折叠等效果
- winform窗体应用实现淡入淡出等效果
- 利用API函数实现图像淡入淡出效果(VB)
- squid配置指南及问题
- 解决打开CHM格式文件出现“网页不能浏览”错误的方法
- 看那似水的年华
- C#中日期型参数为空的处理方法 DataSet 空
- Google Web Search API 实现
- VB实现窗体淡入淡出
- 人民币大小写转换格式
- 丁磊在浙江大学的演讲
- 热转印制作电路板完全教程
- 新做的网站,汽游网,UB学习站
- AWP之使用初步
- js写的简单宠物程序
- 使用W3C DOM 和 JAXP 来建立和输出DOM文档并设置文档参数的方法
- 每天进步一点.十天也有一大步