form scroll event or autoscroll extent?

J

jarb

..Net 1.1

I have a form using autoscroll. My painting isnt working right because of the
way the scrolling is implemented: it only invalidates the new area that gets
scrolled in. I need to either invalidate the entire form on scrolling, or I need
to know the actual size of the loaded form. Not the client rectangle size, but
the form size that stretches offscreen. The scroll bar must know this or it
wouldn't be able to set the scroll extents. I cannot find a way to do either one
in the api.

thanks
 
S

Stoitcho Goutsev \(100\)

jarb,

Actually autoscroll doesn't work this way. What autoscroll scrolls only the
controls inside the cotainer and it does this by modifying their Location
properties. In order to calculate the scrolling limits the container perform
union operation on all child controls bounding rectangles.
 
J

jarb

Stoitcho said:
jarb,

Actually autoscroll doesn't work this way. What autoscroll scrolls only the
controls inside the cotainer and it does this by modifying their Location
properties.

Try making a form which paints its background a random color in the OnPaint
method. Enable autoscroll and add some controls offscreen. Then run and scroll
one click at a time. You will see what im talking about. A nice optimization,
but if you're form is painting something that isnt tied to the scroll it ends up
looking very wrong.

In order to calculate the scrolling limits the container perform
union operation on all child controls bounding rectangles.

Ok. Thanks. I can use that to adjust my painting.
 
S

Stoitcho Goutsev \(100\)

jarb,

I see now what you are talking about. Unfortunately windwos forms autoscroll
feature has never considered the this use case. If you want to scroll a
drawing just add a control say panel or picture box or whatever. Make it as
big as you want and draw there. If the image is bigger than the form (thus
the control is bigger) then the scrollbars will showup and you can move the
control around and this way scrolling the picture.Even as far as I can
remember in .NET 1.x there was no way to find out the autosctoll scrollbars'
thumb position. I think they added this information in 2.0.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top