Hi all. I have a user control that contains a picturebox within a panel with
the panel set to autoscroll the picturebox. One thing that I have noticed
with the default functionality is when you click and drag the scroll box
(thumb track) the picturebox does not scroll until you release it. Is there
a way to scroll the picturebox while you move the scrollbox (like when you
scroll a web page)? Or do you have to use the scroll bar controls instead of
autoscroll and manually code this functionality?

Any ideas?

Paul

Re: Smooth scrolling image or picturebox by Bob

Bob
Wed Oct 20 17:27:00 CDT 2004

Try this... (after my signature)

This works fine for me. It may affect your application if you have the "Show
contents of window while dragging" setting enabled in the display
properties.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml


---------------------------------------------------------

Imports System.Drawing.Drawing2D

Public Class Form1

Inherits System.Windows.Forms.Form

Dim image As image

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents Panel1 As System.Windows.Forms.Panel

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

Me.Panel1 = New System.Windows.Forms.Panel

Me.SuspendLayout()

'

'Panel1

'

Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill

Me.Panel1.Location = New System.Drawing.Point(0, 0)

Me.Panel1.Name = "Panel1"

Me.Panel1.Size = New System.Drawing.Size(292, 266)

Me.Panel1.TabIndex = 0

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(292, 266)

Me.Controls.Add(Me.Panel1)

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint

e.Graphics.Transform = New Matrix(1, 0, 0, 1,
Me.Panel1.AutoScrollPosition.X, Me.Panel1.AutoScrollPosition.Y)

e.Graphics.DrawImageUnscaled(image, 0, 0)

End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load

image = image.FromFile("c:\foo.jpg")

Me.Panel1.AutoScrollMinSize = image.Size

Me.Panel1.AutoScroll = True

End Sub

End Class


---------------------------------------------------------



"Paul Loveless" <paull2@rogers.com> wrote in message
news:sOmdnWun184l4evcRVn-2A@rogers.com...
> Hi all. I have a user control that contains a picturebox within a panel
with
> the panel set to autoscroll the picturebox. One thing that I have noticed
> with the default functionality is when you click and drag the scroll box
> (thumb track) the picturebox does not scroll until you release it. Is
there
> a way to scroll the picturebox while you move the scrollbox (like when you
> scroll a web page)? Or do you have to use the scroll bar controls instead
of
> autoscroll and manually code this functionality?
>
> Any ideas?
>
> Paul
>
>



Re: Smooth scrolling image or picturebox by Paul

Paul
Wed Oct 20 18:24:38 CDT 2004

Hmm...not quite what I had in mind Bob. While the picture does scroll
properly, my earlier point still stands. What I mean is, when you click and
drag a scroll bar's thumbtrack, I want the picture itself to scroll while
you are dragging the thumbtrack. Scrolling any web page in IE will
illustrate this. In your example, when you click and drag the thumbtrack,
the picture does not scroll until "after" you release the mouse button.

However, I like how you use a matrix to perform a picture translation.
Thanks for the feedback though. If you understand what I mean and have any
other ideas, I'm all ears.

Take care,
Paul


"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:e9XimQvtEHA.3932@TK2MSFTNGP10.phx.gbl...
> Try this... (after my signature)
>
> This works fine for me. It may affect your application if you have the
"Show
> contents of window while dragging" setting enabled in the display
> properties.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/gdiplus_faq.htm
>
> The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
> Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
> Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
>
>
> ---------------------------------------------------------
>
> [code deleted]
>
> "Paul Loveless" <paull2@rogers.com> wrote in message
> news:sOmdnWun184l4evcRVn-2A@rogers.com...
> > Hi all. I have a user control that contains a picturebox within a panel
> with
> > the panel set to autoscroll the picturebox. One thing that I have
noticed
> > with the default functionality is when you click and drag the scroll box
> > (thumb track) the picturebox does not scroll until you release it. Is
> there
> > a way to scroll the picturebox while you move the scrollbox (like when
you
> > scroll a web page)? Or do you have to use the scroll bar controls
instead
> of
> > autoscroll and manually code this functionality?
> >
> > Any ideas?
> >
> > Paul
> >
> >
>
>



Re: Smooth scrolling image or picturebox by Bob

Bob
Thu Oct 21 06:33:55 CDT 2004

It *does* scroll on thumbtrack on my system. Quite smoothly actually.

Have you set the display options for show window contents while dragging?
This may affect that functionality...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml






"Paul L" <paull2@rogers.com> wrote in message
news:JZWdnYlb298rbuvcRVn-qg@rogers.com...
> Hmm...not quite what I had in mind Bob. While the picture does scroll
> properly, my earlier point still stands. What I mean is, when you click
and
> drag a scroll bar's thumbtrack, I want the picture itself to scroll while
> you are dragging the thumbtrack. Scrolling any web page in IE will
> illustrate this. In your example, when you click and drag the thumbtrack,
> the picture does not scroll until "after" you release the mouse button.
>
> However, I like how you use a matrix to perform a picture translation.
> Thanks for the feedback though. If you understand what I mean and have any
> other ideas, I'm all ears.
>
> Take care,
> Paul
>
>
> "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
> news:e9XimQvtEHA.3932@TK2MSFTNGP10.phx.gbl...
> > Try this... (after my signature)
> >
> > This works fine for me. It may affect your application if you have the
> "Show
> > contents of window while dragging" setting enabled in the display
> > properties.
> >
> > --
> > Bob Powell [MVP]
> > Visual C#, System.Drawing
> >
> > Answer those GDI+ questions with the GDI+ FAQ
> > http://www.bobpowell.net/gdiplus_faq.htm
> >
> > The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
> > Windows Forms Tips and Tricks RSS:
http://www.bobpowell.net/tipstricks.xml
> > Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
> >
> >
> > ---------------------------------------------------------
> >
> > [code deleted]
> >
> > "Paul Loveless" <paull2@rogers.com> wrote in message
> > news:sOmdnWun184l4evcRVn-2A@rogers.com...
> > > Hi all. I have a user control that contains a picturebox within a
panel
> > with
> > > the panel set to autoscroll the picturebox. One thing that I have
> noticed
> > > with the default functionality is when you click and drag the scroll
box
> > > (thumb track) the picturebox does not scroll until you release it. Is
> > there
> > > a way to scroll the picturebox while you move the scrollbox (like when
> you
> > > scroll a web page)? Or do you have to use the scroll bar controls
> instead
> > of
> > > autoscroll and manually code this functionality?
> > >
> > > Any ideas?
> > >
> > > Paul
> > >
> > >
> >
> >
>
>



Re: Smooth scrolling image or picturebox by Paul

Paul
Thu Oct 21 10:54:19 CDT 2004

Your right, it does smooth scroll when the display option for showing window
contents is enabled.
However, through my own investigation, I have developed a solution that
doesn't rely on this display setting (which I prefer). If you are
interested, I can send you the code once I've cleaned it up.

Paul

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:ed6IFI2tEHA.2468@TK2MSFTNGP09.phx.gbl...
> It *does* scroll on thumbtrack on my system. Quite smoothly actually.
>
> Have you set the display options for show window contents while dragging?
> This may affect that functionality...
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/gdiplus_faq.htm
>
> The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
> Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
> Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
>
>
>
>
>
>
> "Paul L" <paull2@rogers.com> wrote in message
> news:JZWdnYlb298rbuvcRVn-qg@rogers.com...
> > Hmm...not quite what I had in mind Bob. While the picture does scroll
> > properly, my earlier point still stands. What I mean is, when you click
> and
> > drag a scroll bar's thumbtrack, I want the picture itself to scroll
while
> > you are dragging the thumbtrack. Scrolling any web page in IE will
> > illustrate this. In your example, when you click and drag the
thumbtrack,
> > the picture does not scroll until "after" you release the mouse button.
> >
> > However, I like how you use a matrix to perform a picture translation.
> > Thanks for the feedback though. If you understand what I mean and have
any
> > other ideas, I'm all ears.
> >
> > Take care,
> > Paul
> >
> >
> > "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
> > news:e9XimQvtEHA.3932@TK2MSFTNGP10.phx.gbl...
> > > Try this... (after my signature)
> > >
> > > This works fine for me. It may affect your application if you have the
> > "Show
> > > contents of window while dragging" setting enabled in the display
> > > properties.
> > >
> > > --
> > > Bob Powell [MVP]
> > > Visual C#, System.Drawing
> > >
> > > Answer those GDI+ questions with the GDI+ FAQ
> > > http://www.bobpowell.net/gdiplus_faq.htm
> > >
> > > The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
> > > Windows Forms Tips and Tricks RSS:
> http://www.bobpowell.net/tipstricks.xml
> > > Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
> > >
> > >
> > > ---------------------------------------------------------
> > >
> > > [code deleted]
> > >
> > > "Paul Loveless" <paull2@rogers.com> wrote in message
> > > news:sOmdnWun184l4evcRVn-2A@rogers.com...
> > > > Hi all. I have a user control that contains a picturebox within a
> panel
> > > with
> > > > the panel set to autoscroll the picturebox. One thing that I have
> > noticed
> > > > with the default functionality is when you click and drag the scroll
> box
> > > > (thumb track) the picturebox does not scroll until you release it.
Is
> > > there
> > > > a way to scroll the picturebox while you move the scrollbox (like
when
> > you
> > > > scroll a web page)? Or do you have to use the scroll bar controls
> > instead
> > > of
> > > > autoscroll and manually code this functionality?
> > > >
> > > > Any ideas?
> > > >
> > > > Paul
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: Smooth scrolling image or picturebox by Bob

Bob
Thu Oct 21 15:24:20 CDT 2004

Why not post it here so that others can benefit?

--
Bob Powell [MVP]
Visual C#, System.Drawing

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml






"Paul L" <paull2@rogers.com> wrote in message
news:W5Cdnf3Xf482RurcRVn-og@rogers.com...
> Your right, it does smooth scroll when the display option for showing
window
> contents is enabled.
> However, through my own investigation, I have developed a solution that
> doesn't rely on this display setting (which I prefer). If you are
> interested, I can send you the code once I've cleaned it up.
>
> Paul
>
> "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
> news:ed6IFI2tEHA.2468@TK2MSFTNGP09.phx.gbl...
> > It *does* scroll on thumbtrack on my system. Quite smoothly actually.
> >
> > Have you set the display options for show window contents while
dragging?
> > This may affect that functionality...
> >
> > --
> > Bob Powell [MVP]
> > Visual C#, System.Drawing
> >
> > Answer those GDI+ questions with the GDI+ FAQ
> > http://www.bobpowell.net/gdiplus_faq.htm
> >
> > The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
> > Windows Forms Tips and Tricks RSS:
http://www.bobpowell.net/tipstricks.xml
> > Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
> >
> >
> >
> >
> >
> >
> > "Paul L" <paull2@rogers.com> wrote in message
> > news:JZWdnYlb298rbuvcRVn-qg@rogers.com...
> > > Hmm...not quite what I had in mind Bob. While the picture does scroll
> > > properly, my earlier point still stands. What I mean is, when you
click
> > and
> > > drag a scroll bar's thumbtrack, I want the picture itself to scroll
> while
> > > you are dragging the thumbtrack. Scrolling any web page in IE will
> > > illustrate this. In your example, when you click and drag the
> thumbtrack,
> > > the picture does not scroll until "after" you release the mouse
button.
> > >
> > > However, I like how you use a matrix to perform a picture translation.
> > > Thanks for the feedback though. If you understand what I mean and have
> any
> > > other ideas, I'm all ears.
> > >
> > > Take care,
> > > Paul
> > >
> > >
> > > "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
> > > news:e9XimQvtEHA.3932@TK2MSFTNGP10.phx.gbl...
> > > > Try this... (after my signature)
> > > >
> > > > This works fine for me. It may affect your application if you have
the
> > > "Show
> > > > contents of window while dragging" setting enabled in the display
> > > > properties.
> > > >
> > > > --
> > > > Bob Powell [MVP]
> > > > Visual C#, System.Drawing
> > > >
> > > > Answer those GDI+ questions with the GDI+ FAQ
> > > > http://www.bobpowell.net/gdiplus_faq.htm
> > > >
> > > > The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
> > > > Windows Forms Tips and Tricks RSS:
> > http://www.bobpowell.net/tipstricks.xml
> > > > Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
> > > >
> > > >
> > > > ---------------------------------------------------------
> > > >
> > > > [code deleted]
> > > >
> > > > "Paul Loveless" <paull2@rogers.com> wrote in message
> > > > news:sOmdnWun184l4evcRVn-2A@rogers.com...
> > > > > Hi all. I have a user control that contains a picturebox within a
> > panel
> > > > with
> > > > > the panel set to autoscroll the picturebox. One thing that I have
> > > noticed
> > > > > with the default functionality is when you click and drag the
scroll
> > box
> > > > > (thumb track) the picturebox does not scroll until you release it.
> Is
> > > > there
> > > > > a way to scroll the picturebox while you move the scrollbox (like
> when
> > > you
> > > > > scroll a web page)? Or do you have to use the scroll bar controls
> > > instead
> > > > of
> > > > > autoscroll and manually code this functionality?
> > > > >
> > > > > Any ideas?
> > > > >
> > > > > Paul
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: Smooth scrolling image or picturebox by Paul

Paul
Thu Oct 21 17:58:14 CDT 2004

True. I may not get a chance to post it for a couple of days though.

Paul

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:ea0RDw6tEHA.820@TK2MSFTNGP12.phx.gbl...
> Why not post it here so that others can benefit?
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/gdiplus_faq.htm
>
> The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
> Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
> Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
>
>
>
>
>
>
> "Paul L" <paull2@rogers.com> wrote in message
> news:W5Cdnf3Xf482RurcRVn-og@rogers.com...
> > Your right, it does smooth scroll when the display option for showing
> window
> > contents is enabled.
> > However, through my own investigation, I have developed a solution that
> > doesn't rely on this display setting (which I prefer). If you are
> > interested, I can send you the code once I've cleaned it up.
> >
> > Paul
> >
> > "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
> > news:ed6IFI2tEHA.2468@TK2MSFTNGP09.phx.gbl...
> > > It *does* scroll on thumbtrack on my system. Quite smoothly actually.
> > >
> > > Have you set the display options for show window contents while
> dragging?
> > > This may affect that functionality...
> > >
> > > --
> > > Bob Powell [MVP]
> > > Visual C#, System.Drawing
> > >
> > > Answer those GDI+ questions with the GDI+ FAQ
> > > http://www.bobpowell.net/gdiplus_faq.htm
> > >
> > > The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
> > > Windows Forms Tips and Tricks RSS:
> http://www.bobpowell.net/tipstricks.xml
> > > Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
> > >
> > >
> > >
> > >
> > >
> > >
> > > "Paul L" <paull2@rogers.com> wrote in message
> > > news:JZWdnYlb298rbuvcRVn-qg@rogers.com...
> > > > Hmm...not quite what I had in mind Bob. While the picture does
scroll
> > > > properly, my earlier point still stands. What I mean is, when you
> click
> > > and
> > > > drag a scroll bar's thumbtrack, I want the picture itself to scroll
> > while
> > > > you are dragging the thumbtrack. Scrolling any web page in IE will
> > > > illustrate this. In your example, when you click and drag the
> > thumbtrack,
> > > > the picture does not scroll until "after" you release the mouse
> button.
> > > >
> > > > However, I like how you use a matrix to perform a picture
translation.
> > > > Thanks for the feedback though. If you understand what I mean and
have
> > any
> > > > other ideas, I'm all ears.
> > > >
> > > > Take care,
> > > > Paul
> > > >
> > > >
> > > > "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
> > > > news:e9XimQvtEHA.3932@TK2MSFTNGP10.phx.gbl...
> > > > > Try this... (after my signature)
> > > > >
> > > > > This works fine for me. It may affect your application if you have
> the
> > > > "Show
> > > > > contents of window while dragging" setting enabled in the display
> > > > > properties.
> > > > >
> > > > > --
> > > > > Bob Powell [MVP]
> > > > > Visual C#, System.Drawing
> > > > >
> > > > > Answer those GDI+ questions with the GDI+ FAQ
> > > > > http://www.bobpowell.net/gdiplus_faq.htm
> > > > >
> > > > > The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
> > > > > Windows Forms Tips and Tricks RSS:
> > > http://www.bobpowell.net/tipstricks.xml
> > > > > Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
> > > > >
> > > > >
> > > > > ---------------------------------------------------------
> > > > >
> > > > > [code deleted]
> > > > >
> > > > > "Paul Loveless" <paull2@rogers.com> wrote in message
> > > > > news:sOmdnWun184l4evcRVn-2A@rogers.com...
> > > > > > Hi all. I have a user control that contains a picturebox within
a
> > > panel
> > > > > with
> > > > > > the panel set to autoscroll the picturebox. One thing that I
have
> > > > noticed
> > > > > > with the default functionality is when you click and drag the
> scroll
> > > box
> > > > > > (thumb track) the picturebox does not scroll until you release
it.
> > Is
> > > > > there
> > > > > > a way to scroll the picturebox while you move the scrollbox
(like
> > when
> > > > you
> > > > > > scroll a web page)? Or do you have to use the scroll bar
controls
> > > > instead
> > > > > of
> > > > > > autoscroll and manually code this functionality?
> > > > > >
> > > > > > Any ideas?
> > > > > >
> > > > > > Paul
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>