void far setfillstyle(int pattern, int color);
| 常數 | 值 | 效果 |
|---|---|---|
| EMPTY_FILL | 0 | 背景色填充(擦除) |
| SOLID_FILL | 1 | 實心填充 |
| LINE_FILL | 2 | 平行線填充 |
| LTSLASH_FILL | 3 | 細斜線(陰影) |
| SLASH_FILL | 4 | 粗斜線 |
| BKSLASH_FILL | 5 | 粗反斜線 |
| LTBKSLASH_FILL | 6 | 細反斜線 |
| HATCH_FILL | 7 | 直角網格 |
| XHATCH_FILL | 8 | 斜網格 |
| INTERLEAVE_FILL | 9 | 間隔點 |
| WIDE_DOT_FILL | 10 | 稀疏點 |
| CLOSE_DOT_FILL | 11 | 密集點 |
| USER_FILL | 12 | 用戶自定義(配合 setfillpattern) |
void far setfillpattern(char *upattern, int color);
upattern 指向 8 字節,每字節 8 位定義 8×8 點陣void far getfillpattern(char *upattern); // 取用戶模式
void far getfillsettings(struct fillsettingstype far *info); // 取當前模式與色
struct fillsettingstype {
int pattern;
int color;
};
initgraph() 進入圖形模式setfillstyle() 或 setfillpattern() 設置填充bar, bar3d, pieslice, sector, floodfill 等)closegraph() 恢復文本模式編譯選項:Options → Linker → Graphics Library 選 ON;確保 *.BGI 驅動文件在路徑中。