List Info

Thread: inherit from Winforms Panel and scrolling




inherit from Winforms Panel and scrolling
user name
2006-07-04 13:46:28
What value does the VerticalScroll.ParentControl have before
and after the
first call to VeritcalScroll.Value = val?

On Tue, 4 Jul 2006 14:41:05 +0100, adam
<adam.maillist01HOTPOP.COM> wrote:

>I have inherited from Panel fir a custom control. I draw
the document
>which is a bunch of hand drawn items. I set the
AutoScrollMinSize
>property to control the scroll that the user sees. When
the user clicks
>on an item that is only partly in view I scroll so the
item aligns with
>the top or bottom of the view port.
>
>here's a code snippet for items with the top above the
view port
>
>//Point itemLocation
>
>if (itemLocation.Top < 0)
>{
>    int val = VerticalScroll.Value + itemLocation.Top;
>   // HACK: Alert calling
"VerticalScroll.Value" once doesn NOT work
>   // calling it twice does
>   VerticalScroll.Value = val;
>   VerticalScroll.Value = val;
>   AdjustFormScrollbars(true);
>
>   Invalidate();
>}
>
>I can't imagine that calling VerticalScroll.Value is
correct.
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )