Click to See Complete Forum and Search --> : Scrollable Window (C++ and Windows SDK)


bapon
March 23rd, 2004, 09:49 AM
Hi,

I wrote a c++-program using bcc32 and windows sdk, that draws wandering rectangles on a window. So far working.

Unfortunately my rectangles need to wander past the window boundaries (think of a car that is moving to the right continually).

To bring such a car back to visibility probably involves scrolling to the right.

Here begins my problem.

How do you do that without graphical development tools, using only windows SDK ?

Related question: Does my client area grow beyond the window boundaries, i. e. can I draw a little rectangle at the point x_horizontal = 100000... of my client area ?

Thanks for helping.

Bapon

C.Schlue
March 24th, 2004, 04:00 PM
Add a Scrollbar to your Window using a Range of - say -1000 to 1000.

When drawing your objects, simply subtract the Scrolbars value from each coordinate.

BorisKK
March 25th, 2004, 06:57 AM
You can draw objects partially or completely outside the visible client area of your window.

To move the whole content of a window (e.g., in a response to a scrollbar message) you can use SetWindowOrgEx (specifies the logical coordinates of the point which will be drawn in the top left corner of the window in case of mapping mode MM_TEXT) or SetViewportOrg (specifies the device point corresponding to logical coordinates 0, 0). Then redraw the window (using ScrollWindowEx prior to SetWindow/ViewportOrgEx is strongly recommended for smoother scrolling).