在VB中,怎样将labei字体随机放大和缩小还有还原
1个回答
展开全部
Dim Flag As Boolean, Temp As Integer, Mystr As String Private Sub Command1_Click() Dim x As Integer Flag = Not (Flag) If Flag = True Then Command1.Caption = "stop" Timer1.Enabled = True Else Command1.Caption = Mystr Timer1.Enabled = False End If End Sub Private Sub Command2_Click() Flag = False Timer1.Enabled = False Label1.FontSize = Temp Command1.Caption = Mystr End Sub Private Sub Form_Load() Timer1.Interval = 500 '调整变化时间 Timer1.Enabled = False Temp = Label1.FontSize '保存字符串原始大小 Label1.Caption = "你好!" Command2.Caption = "还原" Mystr = "随机放大缩小并还原" Command1.Caption = Mystr End Sub Private Sub Timer1_Timer() '进行字符串大小变化 Randomize Do x = Int(Rnd * 20) + 10 Label1.Width = Label1.Width * x Label1.Height = Label1.Height * x Label1.FontSize = x DoEvents Loop While Flag = False End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询