W
Workgroups
Not having much luck tracking this down...
I'm working with a form, Form1, which contains a panel called pnlParent.
Both Form1 and pnlParent have AutoScroll = False.
pnlParent contains a panel called pnlScroller. pnlScroller.AutoScroll =
True. Finally, pnlScroller contains a custom control I wrote (in which I
override OnPaint & paint entirely custom, if that matters). So in summary
there are 4 controls with the following parent/child heiarchy:
Form1 -> pnlParent -> pnlScroller (autoscrolls) -> myControl (custom
painted)
myControl is always bigger in dimensions than pnlScroller, so pnlScroller
always shows both vertical and horizontal scrollbars. At run time, if I
grab either of pnlScroller's scrollbars & move it anywhere, I can scroll
over myControl and it works as I would expect to "scroll over" myControl.
If I then "click away" from Form1 (say, to the desktop) so that Form1 looses
Focus, the scroll bars on pnlScroller remain where I left them.
However, clicking back (or, Alt+Tab) onto on to Form1 so that it regains
Focus causes the scrollbars on pnlScroller to both return to 0,0. This is
an undesired feature of my application, because I want pnlScroller's scroll
bars to remain stationary unless the user scrolls them (I do not want
application focus to alter the scroll position). I do not have any code in
the application that programatically sets the scroll position.
I have tried to trap where this is happening in some of the obvious places,
like Form1.GotFocus, Form1.Activated and pnlScroller.GotFocus but by the
time these events have fired, the scrollbars have already 'adjusted'
themselves to 0,0. Any advice on where I can set a trap to catch this as it
is happening? I believe that pnlScroller is attempting to perform some
logic where it tries to "fit" myControl into it's viewable area and the
scrolling to position 0,0 in an artifact of this attempt. But since this is
an impossible task (because myControl is always larger than pnlScroller), I
want to supress this behavior some how.
I'm working with a form, Form1, which contains a panel called pnlParent.
Both Form1 and pnlParent have AutoScroll = False.
pnlParent contains a panel called pnlScroller. pnlScroller.AutoScroll =
True. Finally, pnlScroller contains a custom control I wrote (in which I
override OnPaint & paint entirely custom, if that matters). So in summary
there are 4 controls with the following parent/child heiarchy:
Form1 -> pnlParent -> pnlScroller (autoscrolls) -> myControl (custom
painted)
myControl is always bigger in dimensions than pnlScroller, so pnlScroller
always shows both vertical and horizontal scrollbars. At run time, if I
grab either of pnlScroller's scrollbars & move it anywhere, I can scroll
over myControl and it works as I would expect to "scroll over" myControl.
If I then "click away" from Form1 (say, to the desktop) so that Form1 looses
Focus, the scroll bars on pnlScroller remain where I left them.
However, clicking back (or, Alt+Tab) onto on to Form1 so that it regains
Focus causes the scrollbars on pnlScroller to both return to 0,0. This is
an undesired feature of my application, because I want pnlScroller's scroll
bars to remain stationary unless the user scrolls them (I do not want
application focus to alter the scroll position). I do not have any code in
the application that programatically sets the scroll position.
I have tried to trap where this is happening in some of the obvious places,
like Form1.GotFocus, Form1.Activated and pnlScroller.GotFocus but by the
time these events have fired, the scrollbars have already 'adjusted'
themselves to 0,0. Any advice on where I can set a trap to catch this as it
is happening? I believe that pnlScroller is attempting to perform some
logic where it tries to "fit" myControl into it's viewable area and the
scrolling to position 0,0 in an artifact of this attempt. But since this is
an impossible task (because myControl is always larger than pnlScroller), I
want to supress this behavior some how.