By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,422 Members | 1,455 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,422 IT Pros & Developers. It's quick & easy.

Autoscroll and Paint

P: n/a
Hi, All:
When using AutoScroll feature, the UserControl moves the unchanged
part and only paints the changed part.

This only works under following situations:
1. when OnPaint() function always paints the entire view
eg: OnPaint() always draws 100 lines of text, even some lines
are invisible.
2. OnPaint() method only paints the visible portion, but they are
painted exactly same as if the entire view is painted.

If it paints differently, it will not work.

My program is painting a list of lines. What I want do implement
is no matter user use pagedown/pageup, or arrow key, or click the
scroll
bars, the control paints based on lines. So the position of the
first visible line is always fixed.

If I paint all the lines or calculate the position of the first line
as if all lines are painted, the scroll works fine. but the position
of the first visible line changes. When I press pagedown, it scrolls
the height of the control, which may result in showing bottm half of
the last line on top.

If I fix the position of the first line, it will not paint
correctly.
The new lines are not showing until another window covers and
uncover
the control. This means the program actually paints all new lines,
but
they are invisible.

Can anyone explain what's happening?

Cheers
shane

Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.