下面是代码:
新建一个Txt文档,复制下面代码保存为.Frm 就可以使用了
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6480
ClientLeft = 60
ClientTop = 450
ClientWidth = 9630
LinkTopic = "Form1"
ScaleHeight = 6480
ScaleWidth = 9630
StartUpPosition = 3 '窗口缺省
Begin VB.VScrollBar VScroll1
Height = 6495
Left = 9240
Max = 100
TabIndex = 1
Top = 0
Width = 375
End
Begin VB.Timer Timer1
Interval = 100
Left = 9600
Top = 0
End
Begin VB.Label Label1
Caption = "A"
Height = 6375
Left = 0
TabIndex = 0
Top = 0
Width = 9135
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Timer1_Timer()
Label1.Font.Size = Label1.Font.Size + VScroll1
End Sub
添加两个标签,一个按钮,一个Vscrollbar,一个timer
程序如下:
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
With VScroll1
.Max = 4000
.Min = 500 ' 快慢程度自己设定
End With
Label1.FontSize = 8 '初始字体大小
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
If Label1.FontSize > 72 Then
Label1.FontSize = 8 '字体太大时,字体大小返回最小值
Else
Label1.FontSize = Label1.FontSize + 0.5 '即字体每次增加0.5,每次增大量自己设置
End If
Label2.Caption = " 当前字体大小是:" & Label1.FontSize
End Sub
Private Sub VScroll1_Change()
Timer1.Interval = VScroll1.Value
End Sub
如图