Tim Robinson wrote:
| "Allan Bruce" <allanmb@TAKEAWAYf2s.com> wrote in message
| news:bdunk6$s5o$1@news.freedom2surf.net...
|| Hi there,
|| I have created a window with the WS_VSCROLL style. I have a memoryDC which
|| I use to blit to the main window depending on the current position of the
|| scroll position. My problem is that, I am listing the contents of a
|| directory, and if the directory has a lot of files, then I need a very big
|| memoryDC. The memoryDC only is created upto around 1280*5000. How do I get
|| around this? Am I well off the track? Any suggestions are greatly
|| appreciated.
|
| Easy solution: don't use a memory DC. Draw directly to the window in
| WM_PAINT.
As a variation on the theme, create the memoryDC to be of the same size
as the visible area of your window; draw onto it and bitblt the contents
just before EndPaint. In this way, you will reduce flicker (compared
with drawing drawing onto the window) while having low memory usage
(compared with drawing onto a 1280*5000 memoryDC).
Of course, that implies that you should develop the logic to draw only
the visible part of the image. (OK, drawing outside the memoryDC boundaries
is harmless, but it's waste of time). As Tim said, you can use
SetViewportOrgEx (based on scroll position) to offset the coordinates,
but your for/while loop should have some test when it should begin
to draw and when it should break (because you're outside of the
visible area).
--
Jugoslav
___________
www.geocities.com/jdujic