'其实大向说的没错,用Image控件就可以实现,我也讨厌用第三方控件。 '专门给楼主你写了段示例代码: '在窗体中添加一个Image控件和一个HScrollBar控件,所有属性取默认值 '窗体的代码 Private IntWidth As Long '图象初始宽度 Private IntHeight As Long '图象初始高度 Private IntScale As Single '图象比例Private Sub Form_Load() Image1.Stretch = True '调整图形的大小以适应图像控件 Dim img As IPictureDisp '加载图片 Set img = LoadPicture("C:\Documents and Settings\xtgl\My Documents\My Pictures\2005_9_1_31198_431198.jpg") IntWidth = img.Width '保存图象初始宽度 IntHeight = img.Height '保存图象初始高度 IntScale = IntHeight / IntWidth '保存图象比例 Set Image1.Picture = img '显示图象 End SubPrivate Sub HScroll1_Change() '改变图象大小 Image1.Width = HScroll1.Value Image1.Height = HScroll1.Value * IntScale End Sub
stretch=true
不就行了?
'专门给楼主你写了段示例代码:
'在窗体中添加一个Image控件和一个HScrollBar控件,所有属性取默认值
'窗体的代码
Private IntWidth As Long '图象初始宽度
Private IntHeight As Long '图象初始高度
Private IntScale As Single '图象比例Private Sub Form_Load()
Image1.Stretch = True '调整图形的大小以适应图像控件
Dim img As IPictureDisp '加载图片
Set img = LoadPicture("C:\Documents and Settings\xtgl\My Documents\My Pictures\2005_9_1_31198_431198.jpg")
IntWidth = img.Width '保存图象初始宽度
IntHeight = img.Height '保存图象初始高度
IntScale = IntHeight / IntWidth '保存图象比例
Set Image1.Picture = img '显示图象
End SubPrivate Sub HScroll1_Change()
'改变图象大小
Image1.Width = HScroll1.Value
Image1.Height = HScroll1.Value * IntScale
End Sub
你说的控件名叫什么?
IMAGE是可以解决这种问题,但在预览方面控制不好