Connecting Tech Pros Worldwide Forums | Help | Site Map

Panel control resets its scroll position

Paul E Collins
Guest
 
Posts: n/a
#1: May 28 '06
I'm writing an application whose main window consists of a particular
UserControl that I have placed inside a docked Panel so that it will
fill the whole window. The panel also has the AutoScroll property set
so that the user can scroll if the inner control is larger than the
window.

Various dialogue boxes (displayed with Form.ShowDialog(this)) are
available for setting properties, etc., and I've noticed that when a
dialogue box is closed, the panel immediately reverts back to its top
left-hand corner, forgetting where the user had scrolled.

I can probably work around this by saving and restoring the scroll
position, but is this a known bug or some feature of the Panel that
I'm overlooking? It's definitely not my code.

Eq.



Chris Jobson
Guest
 
Posts: n/a
#2: May 28 '06

re: Panel control resets its scroll position


"Paul E Collins" <find_my_real_address@CL4.org> wrote in message
news:D6udnSaKb5EKjOfZnZ2dnUVZ8s6dnZ2d@bt.com...[color=blue]
> I'm writing an application whose main window consists of a particular
> UserControl that I have placed inside a docked Panel so that it will fill
> the whole window. The panel also has the AutoScroll property set so that
> the user can scroll if the inner control is larger than the window.
>
> Various dialogue boxes (displayed with Form.ShowDialog(this)) are
> available for setting properties, etc., and I've noticed that when a
> dialogue box is closed, the panel immediately reverts back to its top
> left-hand corner, forgetting where the user had scrolled.
>
> I can probably work around this by saving and restoring the scroll
> position, but is this a known bug or some feature of the Panel that I'm
> overlooking? It's definitely not my code.[/color]

Not sure if it's the same problem, but I've noticed that if the user scrolls
a form/panel so that the active control is not fully visible then when the
form regains focus after losing it (whether because another form is shown,
or because the user switches away to another application), the form/panel
scrolls to make the active control visible. Unfortunately I can't find any
simple way to prevent this.

Chris Jobson


tony lock
Guest
 
Posts: n/a
#3: May 29 '06

re: Panel control resets its scroll position


I found exactly the same problem, if you save the scroll positions before
calling the dialog box. Then after the dialog is closed set the scroll
positions back to their original positions, you will stop the contents of the
panel moving, but the scroll bar(s) are to the left/top i.e. they do not
match the contents.

"Paul E Collins" wrote:
[color=blue]
> I'm writing an application whose main window consists of a particular
> UserControl that I have placed inside a docked Panel so that it will
> fill the whole window. The panel also has the AutoScroll property set
> so that the user can scroll if the inner control is larger than the
> window.
>
> Various dialogue boxes (displayed with Form.ShowDialog(this)) are
> available for setting properties, etc., and I've noticed that when a
> dialogue box is closed, the panel immediately reverts back to its top
> left-hand corner, forgetting where the user had scrolled.
>
> I can probably work around this by saving and restoring the scroll
> position, but is this a known bug or some feature of the Panel that
> I'm overlooking? It's definitely not my code.
>
> Eq.
>
>
>[/color]
Closed Thread