1个回答
展开全部
如果是Image控件就很容易实现,如果是PictureBox控件就比较麻烦一些,要用PaintPicture方法重画才能使图片改变宽度。下面是Image控件的实现方法:
Private Sub Form_Load()
Image1.Stretch = True
Image1.Width = HScroll1.Width
HScroll1.SmallChange = 60
HScroll1.LargeChange = 600
HScroll1.Max = Image1.Width
HScroll1.Min = 15
HScroll1.Value = HScroll1.Max \ 2
End Sub
Private Sub HScroll1_Change()
Image1.Width = HScroll1.Value
End Sub
Private Sub HScroll1_Scroll()
Image1.Width = HScroll1.Value
End Sub
Private Sub Form_Load()
Image1.Stretch = True
Image1.Width = HScroll1.Width
HScroll1.SmallChange = 60
HScroll1.LargeChange = 600
HScroll1.Max = Image1.Width
HScroll1.Min = 15
HScroll1.Value = HScroll1.Max \ 2
End Sub
Private Sub HScroll1_Change()
Image1.Width = HScroll1.Value
End Sub
Private Sub HScroll1_Scroll()
Image1.Width = HScroll1.Value
End Sub
追问
谢谢您的答案。我没有学Image的。不过您的答案比真正的答案还有好啊!您真厉害!
题目上MIN=200,MAX=2000,largechange=200.并且不能使用任何变量。我看额答案是
Private Sub form_Change()
Image1.Width = HScroll1.Value
End Sub
Private Sub HScroll1_Scroll()
Image1.Width = HScroll1.Value
End Sub
可是我运行了,不行。你可以把这个该一码?
追答
没有form_Change这个事件的,应该是HScroll1_Change,就是和我上面的回答一样的。你把min、max、largechange改为你题目中的数值就行了
Private Sub Form_Load()
Image1.Stretch = True
HScroll1.LargeChange = 200
HScroll1.Max = 2000
HScroll1.Min = 200
HScroll1.Value = HScroll1.Max \ 2
End Sub
Private Sub HScroll1_Change()
Image1.Width = HScroll1.Value
End Sub
Private Sub HScroll1_Scroll()
Image1.Width = HScroll1.Value
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |