vb练习题 10
编辑一个“编辑图片”程序用来浏览、放大和缩小图片文件。程序运行后,用户单击【放大】按钮放大图片,单击【缩小】按钮缩小图片,单击【恢复】按钮,将图片恢复到最初的尺寸。状态栏...
编辑一个“编辑图片”程序用来浏览、放大和缩小图片文件。程序运行后,用户单击【放大】按钮放大图片,单击【缩小】按钮缩小图片,单击【恢复】按钮,将图片恢复到最初的尺寸。状态栏中会显示当前日期及当前浏览的图片名称。所有按钮由ToolBar控件创建。
展开
展开全部
三个按钮 一个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
有什么问题继续提问
继续关注中……
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
有什么问题继续提问
继续关注中……
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询