Bryan Leong wrote:

> It is any way i can scroll a bitmap using form.
> if not how can i scroll a bitmap 
> can anyone show me some simple code that can scroll a bitmap.

You mean with scrollbars, or as an animation?

Here's some code that would animate a bitmap and make it
scroll to the right:

        Bitmap* bitmapptr = TheBitmap();
        Coord bitmapwidth, bitmapheight;
        Coord x = TheXCoordinate();
        Coord y = TheYCoordinate();
        RectangleType scrollrect, vacatedrect;

        BmpGlueGetDimensions (bitmapptr, &bitmapwidth, &bitmapheight, NULL);

        scrollrect.extent.x = bitmapwidth;
        scrollrect.extent.y = bitmapheight;
        scrollrect.topLeft.x = x;
        scrollrect.topLeft.y = y;

        WinDrawBitmap (bitmapptr, x, y);
        for (Coord offset = 0; offset <= bitmapwidth; offset += increment)
        {
            WinScrollRectangle (&scrollrect, winRight, increment, &vacatedrect);
            WinEraseRectangle (&vacatedrect, 0);
            scrollrect.topLeft.x += increment;
            scrollrect.extent.x -= increment;
        }

If you want to scroll a bitmap around on the screen based on what
a scrollbar does, then the best approach is probably to make an
offscreen window from the bitmap (using WinCreateBitmapWindow())
and then use WinCopyRectangle() to copy whatever portion you
desire into the draw window.  (You can get the draw window
from a formptr with FrmGetWinHandle().)

  - Logan

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to