电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

C语言的图形操作和鼠标控制技巧

C语言的图形操作和鼠标控制技巧_第1页
1/6
C语言的图形操作和鼠标控制技巧_第2页
2/6
C语言的图形操作和鼠标控制技巧_第3页
3/6
一、图形操作基本简介 1. 必要的头文件 #include #include #include #include #include 2. 必须的系统变量 int GraphDriver; int GraphMode; double AspectRatio; int MaxX, MaxY; int MaxColors; int ErrorCode; struct palettetype palette; 3. 初始化图形界面初始化出错处理关闭图形界面 GraphDriver = DETECT; initgraph( &GraphDriver, &GraphMode, " " ); initgraph( &GraphDriver, &GraphMode, “d:\\tc" ); ErrorCode = graphresult(); if( ErrorCode != grOk ){ printf(" Graphics System Error: %s\n", grapherrormsg( ErrorCode ) ); exit( 1 ); } closegraph(); /* Return the system to text mode */ 4. 取得必须的信息 getpalette( &palette ); MaxColors = getmaxcolor() + 1; MaxX = getmaxx(); MaxY = getmaxy(); AspectRatio = (double)xasp / (double)yasp; 5. 一些常用的画图函数 outtext( buffer ),outtextxy(x,y,buffer) line(x0,y0,x1,y1);linerel( );lineto( ) circle(int x, int y, int radius); arc( ) bar(int l, int t, int r, int b);bar3d( ); moveto(int x, int y);moverel(dx,dy);getx( ) putpixel(x,y,color); getpixel(x,y) setcolor( );setbkcolor( );getcolor( );getbkcolor outtext( buffer ),outtextxy(x,y,buffer) line(x0,y0,x1,y1);linerel( );lineto( ) circle(int x, int y, int radius); arc( ) bar(int l, int t, int r, int b);bar3d( ); moveto(int x, int y);moverel(dx,dy);getx( ) putpixel(x,y,color); getpixel(x,y) setcolor( );setbkcolor( );getcolor( );getbkcolor( ); 看联机帮助,或参见下面的部分文字 显示器是个人计算机的重要组成部分。随着计算机硬件的发展,现在有不同的显示器及其适配器用在个人计算机系统中。常用的显示器有 CGA,Herclus,EGA,VGA,SVGA,TVGA等等。显示模式有两种,文本模式和图象模式,DOS操作系统中默认的是文本模式。在图形模式中,整个屏幕按显示器的分辨率分成点阵,EGA可以是643*350或640*200的点阵,CGA可以是640*200或320*200的点阵,VGA则可以 640*200*16色,或640*480*16色,本程序中用的就是后一种(VGAHI)。...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

C语言的图形操作和鼠标控制技巧

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部