VB窗体加载特效
发布网友
发布时间:2022-04-18 07:06
我来回答
共2个回答
热心网友
时间:2022-04-18 08:35
Dim b As Boolean
Private Sub Form_Load()
Me.Width = 1
Me.Height = 1
b = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
b = True
Cancel = 0
End Sub
Private Sub Timer1_Timer()
If b = False Then
If Me.Width <> 3600 Then Me.Width = Me.Width + 1 '3600为你的标准宽度
If Me.Height <> 3600 Then Me.Height = Me.Height + 1 '3600为你的标准高度
Else
If Me.Width <> 1 Then Me.Width = Me.Width - 1
If Me.Height <> 1 Then Me.Height = Me.Height - 1
If Me.Width = 1 And Me.Height = 1 Then End
End If
End Sub
如果你的窗体没边框的话就可以到一个点
热心网友
时间:2022-04-18 09:53
可以用一个timer控件实现
Private Sub Form_Load()
Me.Left = Screen.Width / 2
Me.Top = Screen.Height / 2
Me.Height = 0
Me.Width = 0
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Form1.Height = Form1.Height + 50'50是放大的速度
Form1.Width = Form1.Width + 50
Form1.Left = (Screen.Width - Form1.Width) / 2
Form1.Top = (Screen.Height - Form1.Height) / 2
If Form1.Width > Screen.Width / 2 Then Timer1.Enabled = False
End Sub
也可以定义timer控件的Interval属性改变速度
缩小的原理是一样的