VB怎么通过横竖滚动条来改变图片的大小,竖条改变高度,横条改变宽度。
1个回答
展开全部
'给个示例,图片地址自己改一下。
'使用Image控件,让控件来自己调整。
Public H, W As Single
Private Sub Form_Load()
Image1.Stretch = True
Image1.Picture = LoadPicture("D:\My Documents\My Pictures\20070825\111.jpg")
VScroll1.Max = 100
VScroll1.Min = 0
VScroll1.SmallChange = 1
VScroll1.LargeChange = 5
HScroll1.Max = 100
HScroll1.Min = 0
HScroll1.SmallChange = 1
HScroll1.LargeChange = 5
H = Image1.Height
W = Image1.Width
End Sub
Private Sub VScroll1_Change()
Image1.Height = H * (1 + VScroll1.Value / 100)
Image1.Picture = LoadPicture("D:\My Documents\My Pictures\20070825\111.jpg")
End Sub
Private Sub HScroll1_Change()
Image1.Width = W * (1 + HScroll1.Value / 100)
Image1.Picture = LoadPicture("D:\My Documents\My Pictures\20070825\111.jpg")
End Sub
'使用Image控件,让控件来自己调整。
Public H, W As Single
Private Sub Form_Load()
Image1.Stretch = True
Image1.Picture = LoadPicture("D:\My Documents\My Pictures\20070825\111.jpg")
VScroll1.Max = 100
VScroll1.Min = 0
VScroll1.SmallChange = 1
VScroll1.LargeChange = 5
HScroll1.Max = 100
HScroll1.Min = 0
HScroll1.SmallChange = 1
HScroll1.LargeChange = 5
H = Image1.Height
W = Image1.Width
End Sub
Private Sub VScroll1_Change()
Image1.Height = H * (1 + VScroll1.Value / 100)
Image1.Picture = LoadPicture("D:\My Documents\My Pictures\20070825\111.jpg")
End Sub
Private Sub HScroll1_Change()
Image1.Width = W * (1 + HScroll1.Value / 100)
Image1.Picture = LoadPicture("D:\My Documents\My Pictures\20070825\111.jpg")
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询