液晶显示器如何运行tc中图形程序

来源:百度知道 编辑:UC知道 时间:2024/05/07 17:27:03
编译连接都通过,最后一步不行,例如如下程序:
#include"stdio.h"
#include"graphics.h"
main()
{
int graphdriver=DETECT;
int graphmode,x,y;
detectgraph(&graphdriver,&graphmode);
initgraph(&graphdriver,&graphmode,"");
cleardevice();
for(y=20;y<=200;y+=20)
{ for(x=20;x<=400;x+=12)
{ setcolor(GREEN);
line(x,y,x+4,y);
putpixel(x+8,y,YELLOW) ;
}
}
getch();
closegraph();
}

起初弹出16位子dos系统.......,后来运行是又时图形没有初始化graphice not initialized(use 'initgraph')

跟显示器类别没关系,这个程序用的是老式的VGA等显示模式,必须到DOS下去运行.Windows的显示大多都是24bit或32bit真彩或增强色显示,不支持VGA等模式.你的DETECT也无法自动检测显示模式.但你可以尝试一下把显示器分辨率和色彩值调到最低.