Scrollbar Question

From: Ron Dahl (rdahl_at_ghp.com)
Date: 08/17/04


Date: Tue, 17 Aug 2004 16:23:02 -0600

I have a form containing a panel and a picturebox inside the panel.
The form load code changes the panel size to 400x400 and the picturebox size
to 800x800
Autoscroll on the panel is set to true.
The picturebox sizemode is set to AutoSize and StretchImage
An image of size 400x400 is loadeded into the picturebox.
Everything works as expected.
I have also added the following code (see end of message).
The pagedown does shift the visible portion of the image in the picturebox
down as I want it to.
However, the bottom part of the vertical scrollbar on the right side of the
panel moves down correctly, but the top part of the scrollbar stays frozen
in place. This just makes the scrollbar appear too long and makes it
unusable for scrolling back to the top.
I'll be happy to email code if this question isn't clear.
Thanks in advance for any help.
Ron Dahl

Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, _

ByVal keyData As System.Windows.Forms.Keys) As Boolean

    Select Case keyData

        Case Keys.PageUp

            MyY += 50

            Me.PictureBox1.Location = New Point(MyX, MyY)

            Me.PictureBox1.Refresh()

        Case Keys.PageDown

            MyY -= 50

            Me.PictureBox1.Location = New Point(MyX, MyY)

            Me.PictureBox1.Refresh()

    End Select

End Function



Relevant Pages

  • Re: GDI limitations dealing with panels and large images
    ... chuck a panel on and place within the panel a ... > of the picturebox, then set the minimum size properties of the scrollbar ... private void vScrollBar1_Scroll(object sender, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Resize panel image and maintain aspect ratio
    ... the panel, ... send the second picturebox to the back. ... Private ptbBreedte, ptbHoogte As Integer ... Private schaalH, schaalB, schaal As Double ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Transparent label over live video stream
    ... Image property of the PictureBox for each frame I capture. ... >> This software has a form with a panel which is the preview window. ...
    (microsoft.public.dotnet.framework.drawing)
  • PictureBox with scroll bar control
    ... yes folks that is progress! ... Someone in this ng suggested just drop your picturebox into a panel ... vertically so as to only have 1 scrollbar at a time. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Transparent Label
    ... the image won't stretch in a panel because there is no SizeMode property. ... > you're seeing the gray background of the Form, not the PictureBox. ... > B) Set the Parent of the Label to be the PictureBox. ...
    (microsoft.public.dotnet.framework.drawing)

Loading