floodfill()函數是給規定的區域內涂色,但是:#include<stdio.h> #include<graphics.h> int main() { int gdriver, gmode; gdriver=DETECT; initgraph(&gdriver, &gmode, ""); setbkcolor(BLUE); cleardevice(); setfillstyle(1, 2); /*設置填充方式*/ setcolor(WHITE); /*設置白色作圖*/ rectangle(100, 100, 330, 380); floodfill(120, 120, 14); /*填充方框以外的區域*/ getch(); closegraph(); return 0; } 為什么這個程序在運行時floodfill()函數不是涂 rectangle(100, 100, 330, 380);表示方框,而是整個屏幕??
1 回答

慕絲7291255
TA貢獻1859條經驗 獲得超6個贊
#include<stdio.h>
#include<graphics.h>
int main(void)
{
int gdriver, gmode;
gdriver=DETECT;
initgraph(&gdriver, &gmode, "");
setbkcolor(BLUE);
cleardevice();
setfillstyle(1,2); /*設置填充方式*/
setcolor(WHITE); /*設置白色作圖*/
rectangle(100, 100, 330, 380);
floodfill(120, 120, WHITE); /*填充方框以外的區域*/
getch();
closegraph();
return 0;
}
把floodfill中的顏色改下就可以了,Wintc中調試通過。
- 1 回答
- 0 關注
- 223 瀏覽
添加回答
舉報
0/150
提交
取消