# include<graphics.h> 这个函数我在Microsoft Visual C++ 运行,总是有错误啊 ? 求解答。
展开全部
首先,#include "graphics.h"是TC专属的一个画图函数,因为它不是标准库,VC是没有的,VC有自己的图形函数。我到没有试过下载#include "graphics.h",因为需要在VC运行#include "graphics.h"是需要插件的,而且#include "graphics.h"是在DOS黑框的画图,不美观,而且已经过时了,真正做项目什么的,一般用VC VC画图函数 1、画笔有两种形式创建画笔一是直接通过GetStockObject()函数来调用二是通过创建画笔来调用HPEN CreatePen(intfnPenStyle,// pen styleintnWidth,// pen widthCOLORREFcrColor// pen color); 创建画笔后必须调用SelectObject函数来将起选入设备环境; 删除画笔可通过DeleteObject 函数来实现; 2、画刷创建画刷 一是通过GetStockObject函数来调用 二是通过调用CreateSolidBrush 和CreateHatchBrush来创建画刷HBRUSH CreateSolidBrush( COLORREF crColor // brush color value); HBRUSH CreateHatchBrush( int fnStyle, // hatch style COLORREF clrref // color value);3、颜色通过RGB函数来实现;4、常用的绘图函数设置画笔当前的位置函数MoveToExBOOL MoveToEx( HDC hdc, // handle to device context int X, // x-coordinate of new current position int Y, // y-coordinate of new current position LPPOINT lpPoint // pointer to old current position); 从当前位置向指定坐 点画直线的函数LineToBOOL LineTo( HDC hdc, // device context handle int nXEnd, // x-coordinate of line's ending point int nYEnd // y-coordinate of line's ending point); 从当前位置开始,依次用线段连接lpPoints中指定各点的函数PolylineBOOL Polyline( HDC hdc, // handle to device context CONST POINT *lppt, // pointer to array containing endpoints int cPoints // number of points in the array); 椭圆弧线ArcBOOL Arc( HDC hdc, // handle to device context int nLeftRect, // x-coord of bounding rectangle's upper-left corner int nTopRect, // y-coord of bounding rectangle's upper-left corner int nRightRect, // x-coord of bounding rectangle's lower-right corner int nBottomRect, // y-coord of bounding rectangle's lower-right corner int nXStartArc, // first radial ending point int nYStartArc, // first radial ending point int nXEndArc, // second radial ending point int nYEndArc // second radial ending point);画一个饼图并用当前的画刷进行填充PieBOOL Pie( HDC hdc, // handle to device context int nLeftRect, // x-coord of bounding rectangle's upper-left corner int nTopRect, // y-coord of bounding rectangle's upper-left corner int nRightRect, // x-coord of bounding rectangle's lower-right corner int nBottomRect, // y-coord of bounding rectangle's lower-right corner int nXRadial1, // x-coord of first radial's endpoint int nYRadial1, // y-coord of first radial's endpoint int nXRadial2, // x-coord of second radial's endpoint int nYRadial2 // y-coord of second radial's endpoint); 画一个矩形,并填充RectangleBOOL Rectangle( HDC hdc, // handle to device context int nLeftRect, // x-coord of bounding rectangle's upper-left corner int nTopRect, // y-coord of bounding rectangle's upper-left corner int nRightRect, // x-coord of bounding rectangle's lower-right corner int nBottomRect // y-coord of bounding rectangle's lower-right corner); 画一个椭圆并填充EllipseBOOL Ellipse( HDC hdc, // handle to device context int nLeftRect, // x-coord of bounding rectangle's upper-left corner int nTopRect, // y-coord of bounding rectangle's upper-left corner
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询