3.16 window_setviewport

功能:

这个函数用于设置当前窗口可见区域。


声明:

void window_setviewport(
    int left,
    int top,
    int right,
    int bottom
);



参数:

left

可见区域的左部 x 坐标。

top

可见区域的上部 y 坐标。(left, top) 将成为新的原点。

right

可见区域的右部 x 坐标。

bottom

可见区域的下部 y 坐标。(right-1, bottom-1) 是视图的右下角坐标。


返回值:

(无)


示例:

#include "graphics.h"
int main()
{
    initgraph(640, 480);
    window_setviewport(100, 100, 400, 400);
    rectangle(0, 0, 200, 200);
    getch();
    closegraph();
    return 0;
}