在窗体中有一个picture控件,该picture控件中又包含一个image控件,在image控件中装载一幅有内容的图片,但内容太多就用了Vscroll滚动条,请问如何实现点击滚动条使图片上下滚动??即只使image控件上下滚动而picture控件保持不动!请帮忙写出代码,谢谢了!
    请各位大哥大姐帮小弟一把,拜托了。在线等!!问题解决即给分!!

解决方案 »

  1.   

    http://www.mypcera.com/softxue/vb/new/m37.htm
      

  2.   

    http://paddy.myrice.com/program/10.htm
      

  3.   

    空窗体form1上添加如下代码就可以了:  Private WithEvents Picture1 As PictureBox
        Private WithEvents Image1 As Image
        Private WithEvents HScroll1 As HScrollBar
        Private WithEvents VScroll1 As VScrollBar
        Private Sub Form_Load()Set Picture1 = Controls.Add("vb.picturebox", "picture1", Me)
    Picture1.Visible = True
    Picture1.Move 0, 0, Me.Width, Me.HeightSet Image1 = Controls.Add("vb.image", "image1", Picture1)
    Image1.Visible = True
    Image1.Move 0, 0, Picture1.Width - 600, Picture1.Height - 800Set VScroll1 = Controls.Add("vb.vscrollbar", "vscroll1", Picture1)
    VScroll1.Visible = True
    VScroll1.Move Picture1.Width - 600, 0, 600, Picture1.Height - 800Set HScroll1 = Controls.Add("vb.hscrollbar", "hscroll1", Picture1)
    HScroll1.Visible = True
    HScroll1.Move 0, Picture1.Height - 800, Picture1.Width - 600, 600
    Image1.Picture = LoadPicture("C:\My Documents\My Pictures\旷野中的小屋.jpg")'改成你的图片路径    HScroll1.Max = Image1.Width - Picture1.Width
        HScroll1.SmallChange = 5
        VScroll1.Max = Image1.Height - Picture1.Height
        VScroll1.SmallChange = 5
        End Sub
        Private Sub HScroll1_Change()    Image1.Left = -HScroll1.Value    End Sub
        Private Sub VScroll1_Change()    Image1.Top = -VScroll1.Value    End Sub