次の方法で共有


_WScroll( ) API Library Routine

Scrolls a portion of the contents of a window left or right and up or down.

void _WScroll(WHANDLE wh, Rect r, int dv, int dh)
WHANDLE wh;            /* Window handle. */
Rect r;                     /* Portion to scroll. */
int dv;                        /* Left or right. */
int dh;                     /* Up or down. */

Remarks

  • The r parameter describes the portion of the window to be scrolled.
  • The dv parameter describes the number of characters to scroll the window left or right. If dv is negative, the window contents scroll to the left. If dv is positive, the window contents scroll to the right.
  • The dh parameter describes the number of characters to scroll the window up or down. If dh is negative, the window contents scroll up. If dh is positive, the window contents scroll down.

If both dv and dh are 0, _WScroll( ) clears the characters inside the rectangle.

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.

Example

The following example opens a window and draws a rectangular pattern of Xs. This rectangle is also the scroll rectangle. First, the example scrolls the rectangle up two positions and to the left two positions. Next, it scrolls the rectangle down by four positions and to the right four positions.

Visual FoxPro Code

SET LIBRARY TO WSCROLL 

C Code

#include <pro_ext.h>

FAR WScrollEx(ParamBlk FAR *parm)
{
   WHANDLE wh;
   Point pos;
   Rect rect;

   wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,
      WO_SYSTEMBORDER);
   _WShow(wh);

   rect.top   = 6;
   rect.left   = 6;
   rect.bottom = 12;
   rect.right   = 12;

   for (pos.v = rect.top; pos.v < rect.bottom; pos.v++)
   {
      for (pos.h = rect.left; pos.h < rect.right; pos.h++)
      {
         _WPosCursor(wh, pos);
         _WPutChr(wh, 'X');
      }
   }
   _Execute("WAIT WINDOW 'Press any key to _WScroll(wh,rect,-2,-2)'");
   _WScroll(wh, rect, -2, -2);
   _Execute("WAIT WINDOW 'Press any key to _WScroll(wh,rect,+4,+4)'");
   _WScroll(wh, rect, +4, +4);
}

FoxInfo myFoxInfo[] = {
   {"ONLOAD", (FPFI) WScrollEx, CALLONLOAD, ""},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

See Also

_WClear( ) API Library Routine | Accessing the Visual FoxPro API | _WScrollP( ) API Library Routine | _WPosCursor( ) API Library Routine | _WPutChr( ) API Library Routine