词条 | moveto |
释义 | 函数名: moveto 功 能: 将CP移到(x, y) 用 法: void far moveto(int x, int y); CDC::MoveTo(int x,int y) Cpoint MoveTo(int x,int y) Cpoint MoveTo(POINT point) x:新位置的横坐标 y:新位置的纵坐标 point:标识的一个新的位置,以POINT 结构或CPoint 类对象的形式表示。 程序例: #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; char msg[80]; /* initialize graphics and local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s\", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } /* move the C.P. to location (20, 30) */ moveto(20, 30); /* plot a pixel at the C.P. */ putpixel(getx(), gety(), getmaxcolor()); /* create and output a message at (20, 30) */ sprintf(msg, " (%d, %d)", getx(), gety()); outtextxy(20, 30, msg); /* move to (100, 100) */ moveto(100, 100); /* plot a pixel at the C.P. */ putpixel(getx(), gety(), getmaxcolor()); /* create and output a message at C.P. */ sprintf(msg, " (%d, %d)", getx(), gety()); outtext(msg); /* clean up */ getch(); closegraph(); return 0; } |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。