请问如何在Picturebox里加滚动条

解决方案 »

  1.   

    用hscroll 加 vsroll控件CommonDialog1.Filter = "图片类型(*.bmp,*.jpg,*.gif)|*.bmp;*.jpg;*.gif|位图文件(*.bmp)|*.bmp|jpeg文件(*.jpg)|*.jpg|所有格式文件(*.*)|*.*"
    CommonDialog1.DialogTitle = "打开图片"
    CommonDialog1.CancelError = True
    CommonDialog1.ShowOpen
    Picture1.Cls
    HScroll1.Max = 0
    VScroll1.Max = 0
    Picture1.Move 0, 0
    Picture1.Picture = LoadPicture(CommonDialog1.FileName)
    HScroll1.Visible = False
    VScroll1.Visible = False
    Picture3.Visible = FalseHScroll1.Max = Picture1.Width - 776
    VScroll1.Max = Picture1.Height - 576
    '横竖方向
    If Picture1.Height > 596 And Picture1.Width > 796 Then
        HScroll1.Move 0, Picture2.ScaleHeight - HScroll1.Height, Picture2.ScaleWidth - VScroll1.Width, HScroll1.Height
        VScroll1.Move Picture2.ScaleWidth - VScroll1.Width, 0, VScroll1.Width, Picture2.ScaleHeight - HScroll1.Height
        Picture3.Move VScroll1.Left, HScroll1.Top
        HScroll1.Visible = True
        VScroll1.Visible = True
        Picture3.Visible = True
        Exit Sub
    End If
    '竖方向
    If Picture1.Height > 596 Then
        VScroll1.Max = VScroll1.Max - 20
        VScroll1.Move Picture2.ScaleWidth - VScroll1.Width, 0, VScroll1.Width, Picture2.ScaleHeight
        VScroll1.Visible = True
        Exit Sub
    End If
    '横方向
    If Picture1.Width > 796 Then
        HScroll1.Max = HScroll1.Max - 20
        HScroll1.Move 0, Picture2.ScaleHeight - HScroll1.Height, Picture2.ScaleWidth, HScroll1.Height
        HScroll1.Visible = True
        Exit Sub
    End If
      

  2.   

    http://zhidao.baidu.com/question/760999.html