我最近开始使用 Dev C++ 4.9.9.2 来试验 C 中的图形程序(感谢这个 tutorial)。但出于某种原因setbkcolor()什么都不做。这是代码...
#include <stdio.h>
#include <graphics.h>
#include <conio.h>
int main()
{
initwindow(800,600);
setbkcolor(GREEN); //FAILED. also tried "setbkcolor(2);"
while ( !kbhit() ){}
return 0;
}
我正在使用 Windows 7 Professional。这与操作系统有关吗?
最佳答案
documentation Windows notes 部分说:
Also, only future drawing will use the new background color (anything currently drawn in the old background color will stay in the old color). Calling
setbkcolor(0)
will change the background color to the current color at index[0]
of the palette (rather than always changing the background to black).
你误解了函数的目标。
关于c - setbkcolor() 在 Dev-C++ 4.9.9.2 中无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32184011/