Manual scroll rendering

  • Thread starter Thread starter Workgroups
  • Start date Start date
W

Workgroups

I need to scroll a virtual grid that is 1.2M pixels x 1.28M pixels in size.
I think this is too large of a size for a control or a form, so I think I
need to "fake it" with a custom drawn control.

I do not need to maintain a bitmap or make the control surface physically
larger than the screen, becuase I can create the grid dynamically based upon
any virtual X, Y upper-left coordinate of the currently viewed area. E.g.,
if I am scrolled to X=82503 and Y=53301, I can pain what the grid would
theoretically look like at this position, without having to actually
maintain a grid that is actually that large.

Because I won't be working with a control that is bigger than the
screen/form, I have placed v&h scrollbar controls on my control, and
OnScroll I invalidate the newly scrolled area to trigger OnPaint (modeled
loosely after observing autoscroll's invalidation behavior).

But my problem with the painting is not the new, invalidated area; it's
"shifting" the non-invalidated, already-drawn portion without having to
repaint the whole thing from scratch. I don't know how to do this part - I
think I want to perform a Transform? But it seems rather complex (I don't
really understand the matrix object!)

If I click my vertical scroll bar and the thumb moves 10 pixels "down", in
response to this OnPaint I need to "shift" the currently painted scene up
10px, thus exposing an "invalidated" 10px area at the bottom. I can draw
this new 10px portion just fine, but... how do I perform this "shift" of the
previously painted area? When I used to rely on autoscroll to invalidate
for me, I only had to worry about painting the newly invalidated area and
the "shift" happened automatically (and smoothly) and now without the
benefit of autoscroll I want to reproduce that manually.
 
Try using ScrollWindow.

Private Declare Function ScrollWindow Lib "user32.dll" (ByVal hWnd As Int32,
ByVal XAmount As Int32, ByVal YAmount As Int32, ByRef lpRect As RECT, ByRef
lpClipRect As RECT) As Int32
 
Yes that does the trick. Thanks for your help.

Some Guy said:
Try using ScrollWindow.

Private Declare Function ScrollWindow Lib "user32.dll" (ByVal hWnd As
Int32, ByVal XAmount As Int32, ByVal YAmount As Int32, ByRef lpRect As
RECT, ByRef lpClipRect As RECT) As Int32
 

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

Back
Top