VB 的滚动条问题

来源:百度知道 编辑:UC知道 时间:2024/09/24 00:29:31
怎么给PictureBox加上滚动条?要显示的图片很大

而且滚动条要在图片大小大于PictureBox的框时显示,反之隐藏

你这个可以另外加一个image控件,先把图片loadpicture给image,然后比较image与picture的长和宽。

if image1.width<picture1.width then
hscroll1.visable=false
else
hscroll1.visable=true
hscroll1.min=0
hscroll1.max=image1.width-picture1.width
endif
private sub hscroll1_change()
picture1.paintpicture image1.picure 0,0,picture1.width,picture1.height,hscroll1.value,vscroll1.value,picture1.width,picture1.height
end sub

手打,有错包涵下,垂直滚动条类似。

一楼的思想对,程序错了另外加一个image控件,先把图片loadpicture给image ,改进了下 你看看 多交流
Private Sub Form_Resize()
On Error Resume Next
w = Form1.ScaleWidth - VScroll1.Width
h = Form1.ScaleHeight - HScroll1.Height
VScroll1.Move w, 0, VScroll1.Width, h
HScroll1.Move 0, h, w
With Picture1
.Move 0, 0, w, h
VScroll1.Min = 0
VScroll1.Max = Image1.Height - .Height
HScroll1.Min = 0
HScroll1.Max = Image1.Width - .Width
End With
If Image1.Width < Picture1.Width Th