vb练习题

2025-02-23 22:55:49
推荐回答(1个)
回答1:

三个按钮 一个timer控件 一个image装图片 一个StatusBar, 输入以下代码
Private Sub Form_Load()
Command1.Caption = "放大"
Command2.Caption = "缩小"
Command3.Caption = "恢复"
Dim x As Single
Dim y As Single
x = image1.Height
y = image1.Width
Timer1.Enabled = True
Timer1.Interval = 200
image1.Stretch = True
StatusBar1.SimpleText = Now
End Sub
Private Sub Command1_Click()
Static a As Integer
Static b As Integer
a = a + 1
b = b + 1
image1.Height = image1.Height * a
image1.Width = image1.Width * b
End Sub
Private Sub Command2_Click()
Static a As Integer
Static b As Integer
a = a - 1
b = b - 1
image1.Height = image1.Height / 1.5 '这是缩小的倍数
image1.Width = image1.Width / 1.5
End Sub

Private Sub Command3_Click()
image1.Height = x
image1.Width = y
End Sub

有什么问题继续提问

继续关注中……