古詩詞大全網 - 成語用法 - VB中用滾動條瀏覽圖片的代碼是什麽?

VB中用滾動條瀏覽圖片的代碼是什麽?

窗體上添加兩個同樣大小的Picture控件Picture1、Picture2,再添加HScrollBar滾動條,ID為HScroll1 ,添加VScrollBar滾動條,ID為VScroll1\x0d\添加如下代碼\x0d\Private Sub Form_Load()\x0d\Picture2.AutoSize = True\x0d\Picture2.BorderStyle = 0\x0d\Picture1.ScaleMode = 3\x0d\Picture2.ScaleMode = 3\x0d\HScroll1.Max = Picture2.Width - Picture1.ScaleWidth\x0d\VScroll1.Max = Picture2.Height - Picture1.ScaleHeight\x0d\End Sub\x0d\Private Sub HScroll1_Change()\x0d\Picture2.Left = -HScroll1.Value\x0d\End Sub\x0d\ \x0d\Private Sub HScroll1_Scroll() '實現拖動滾動條時圖像即時滾動\x0d\Picture2.Left = -HScroll1.Value\x0d\End Sub\x0d\Private Sub VScroll1_Change()\x0d\Picture2.Top = -VScroll1.Value\x0d\End Sub\x0d\Private Sub VScroll1_Scroll() '實現拖動滾動條時圖像即時滾動\x0d\Picture2.Top = -VScroll1.Value\x0d\End Sub\x0d\即可實現滾動瀏覽圖片,其實Picture2的屬性Picture設置為要瀏覽的圖片