|
Turbo C 2.0、Borland C++库函数及用例(28) close(handle); return 0; } 函数名: fillellipse 功 能: 画出并填充一椭圆 用 法: void far fillellipse( int x, int y, int xradius, int yradius ); 程序例:#include <graphics.h> #include <conio.h>int main(void) { int gdriver = DETECT, gmode; int xcenter, ycenter, i; initgraph(&gdriver,&gmode,""); xcenter = getmaxx() / 2; ycenter = getmaxy() / 2; for (i=0; i<13; i++) { setfillstyle(i,WHITE); fillellipse(xcenter,ycenter,100,50); getch(); } closegraph(); return 0; } 函数名: fillpoly 功 能: 画并填充一个多边形 用 法: void far fillpoly( int numpoints, int far *polypoints ); 程序例:#include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h>int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int i, maxx, maxy; /* our polygon array */ int poly[8]; /* initialize graphics, local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } maxx = getmaxx(); maxy = getmaxy(); poly[0] = 20; /* 1st vertext */ poly[1] = maxy / 2; poly[2] = maxx - 20; /* 2nd */ poly[3] = 20; poly[4] = maxx - 50; /* 3rd */ poly[5] = maxy - 20; /* 4th vertex. fillpoly automatically closes the polygon. */ poly[6] = maxx / 2; poly[7] = maxy / 2; /* loop through the fill patterns */ for (i=EMPTY_FILL; i<USER_FILL; i++) { /* set fill pattern */ setfillstyle(i, getmaxcolor()); /* draw a filled polygon */ fillpoly(4, poly); getch(); } /* clean up */ closegraph(); return 0; } 函数名: findfirst 功 能: 搜索磁盘目录; 取得下一个匹配的findfirst模式的文件 用 法: int findfirst( char *pathname, struct ffblk *ffblk, int attrib);
|