vb如何使用滚动条调整image尺寸大小?

来源:百度知道 编辑:UC知道 时间:2024/05/17 03:21:02

Dim image1height As Long, image1width As Long
Private Sub Form_Load()
image1height = Image1.Height
image1width = Image1.Width
Image1.Stretch = True
HScroll1.Value = HScroll1.Max
End Sub

Private Sub HScroll1_Change()
Image1.Height = image1height * HScroll1.Value / HScroll1.Max
Image1.Width = image1width * HScroll1.Value / HScroll1.Max
End Sub

在滚动条Change()事件里通过当前滚动条的Value与整个长度的比值,与图片的大小变化关联