[摘要]*.*"CommonDialog1.FilterIndex = 1CommonDialog1.ShowOpenPicture2.Picture = LoadPicture(CommonDi...
*.*"
CommonDialog1.FilterIndex = 1
CommonDialog1.ShowOpen
Picture2.Picture = LoadPicture(CommonDialog1.filename)
VScroll1.Min = 0
HScroll1.Min = 0
VScroll1.Max = Picture2.Height - Picture1.Height
HScroll1.Max = Picture2.Width - Picture1.Width
If HScroll1.Max 〈 0 Then HScroll1.Enabled = False
If VScroll1.Max 〈 0 Then VScroll1.Enabled = False
ErrExit:
End Sub
Private Sub HScroll1-Change()
Picture2.Left = -HScroll1.Value
End Sub
Private Sub VScroll1-Change()
Picture2.Top = -VScroll1.Value
End Sub
该程序通过点击Command1按钮,在弹出的对话框中选择一个图形文件加载到Picture2中,利用水平和垂直滚动条就可以实现图片的滚动。
关键词:给VB控件PictureBox加滚动条的办法