如果PictureBox中的内容高度或宽度超过PictureBox本身的高度或宽度时,如何让它显示出滚动条?在线等!

解决方案 »

  1.   

    没有办法。自己做控件。PictureBox是没有滚动条的。
      

  2.   

    两个容器控件+滚动条Private Sub Form_Load()
     Form1.Width = 5000
     Form1.Height = 5000
     Form1.ScaleMode = vbPixels
     Picture1.ScaleMode = vbPixels
     Picture1.AutoRedraw = True
     Picture1.BorderStyle = 0
    ' picture1.Picture =load("路径")
     Picture1.Move 0, 0
     HScroll1.Top = Form1.ScaleHeight - HScroll1.Height
     HScroll1.Left = 0
     HScroll1.Width = Form1.ScaleWidth
     VScroll1.Top = 0
     VScroll1.Left = Form1.ScaleWidth - VScroll1.Width
     VScroll1.Height = Form1.ScaleHeight - HScroll1.Height
     HScroll1.Max = Picture1.Width - Form1.ScaleWidth
     VScroll1.Max = Picture1.Height - Form1.ScaleHeight
     VScroll1.Visible = (Picture1.Height > Form1.ScaleHeight)
     HScroll1.Visible = (Picture1.Width > Form1.ScaleWidth)
    End Sub
    Private Sub Form_Resize()
      Picture1.Move 0, 0
     HScroll1.Top = Form1.ScaleHeight - HScroll1.Height
     HScroll1.Left = 0
     HScroll1.Width = Form1.ScaleWidth
     VScroll1.Top = 0
     VScroll1.Left = Form1.ScaleWidth - VScroll1.Width
     VScroll1.Height = Form1.ScaleHeight - HScroll1.Height
     VScroll1.Visible = (Picture1.Height > Form1.ScaleHeight)
     HScroll1.Visible = (Picture1.Width > Form1.ScaleWidth)
    End SubPrivate Sub HScroll1_Change()
     Picture1.Left = -HScroll1.Value
     Form1.Caption = HScroll1.Value
    End SubPrivate Sub Picture1_Resize()
      Picture1.Width = Picture1.Width
      Picture1.Height = Picture1.Height
      HScroll1.Max = Picture1.Width - Form1.Width
      VScroll1.Max = Picture1.Height - Form1.Height
    End SubPrivate Sub VScroll1_Change()
     Picture1.Top = -VScroll1.Value
     Form1.Caption = -VScroll1.Value
    End Sub以前写的一个模板还在,不过比较粗糙,
    上面是窗体当容器,窗体上放picturebox和滚动条就可以了
      

  3.   

    2个picture box控件,放上2个滚动条。
    用上面的代码做一点点修改