graphics.h是什么头文件
文件如下:
graphics.h头文件是C语言和visual studio的图形库文件,包含像素函数、线型函数、画线函数、相对画线函数等多种函数,可进行图形的快速编程,如果您的电脑缺少graphics.h头文件就需要下载安装一下,就可实现图形绘制功能了。
其他文件类型说明
alloc.h:说明内存管理函数(分配、释放等)。
asrt.h:定义asrt调试宏。
bios.h:说明调用IBM—PC ROM BIOS子程序的各个函数。
conio.h:说明调用DOS控制台I/O子程序的各个函数。
ctype.h:包含有关字符分类及转换的名类信息(如isalpha和toascii等)。
dir.h:包含有关目录和路径的结构、宏定义和函数。
dos.h:定义和说明MSDOS和8086调用的一些常量和函数。
C++怎么用GRAPHICS.H?
由于graphics.h是TC系列的图形库处理函数,不是标准库内容。而DEV-C++的编译器是GCC,所以DEV-C++中不包含该类库。要想使用,首先先下载两个文件:
graphics.h (放入DEV-C++的安装路径/Dev-Cpp/include/)
libbgi.a (放入DEV-C++的安装路径/Dev-Cpp/lib/)
然后再在DEV-C++的工具栏中 工程(Project)->工程属性(Project Options)-> 参数(Parameters)的 连接器(Linker)中
增加
-lbgi
-lgdi32
-lcomdlg32
-luuid
-loleaut32
-lole32
这样就可以使用#include<graphics.h>了。
graphics.h在Devc++用什么代替
graphics.h在Devc++用graphics.h头函数代替。
DEVC++不支持graphics.h头函数,而且:不支持不等于不提供即使你复制进去,也无法连接相关库。
如果的确想用DEV来写可视化、图形化界面,可以使用windows.h,通过调用相关API,可以支持所有图形操作TC下才有这个文件。
graphics.h不是语言的一部分,是Borland公司的TC/BC系列产品的一部分,DOS下的一个图形驱动。如果你更改了tc的编译环境,那就要重新设置。要是用了非TC的编译器,那是绝对不行的。
Devc++:
(1)它集成了 AStyle 源代码格式整理器,只要点击菜单“AStyle”下的“ 格式化当前文件”,就可以把当前窗口中的源代码按一定的风格迅速整理好排版格式。在当前的 Banzhusoft Dev-C++ v5.15中,默认在保存文件时就自动对当前源代码文件进行格式化整理。
(2)它提供了一些常用的源代码片段,只要点击“插入”按钮就可以选择性地插入常用源代码片段。
(3)支持单文件开发和多文件项目开发。可以针对单文件(无需建立项目)进行编译或调试。
graphics.h的像素函数
功能: 函数putpixel() 在图形模式下屏幕上画一个像素点。
用法:函数调用方式为void putpixel(int x,int y,int color);
说明: 参数x,y为像素点的坐标,color是该像素点的颜色,它可以是颜色符号名,也可以是整型色彩值。
此函数相应的头文件是graphics.h
返回值: 无
例: 在屏幕上(6,8)处画一个红色像素点:
putpixel(6,8,RED); 功能: 函数getpixel()返回像素点颜色值。
用法: 该函数调用方式为int getpixel(int x,int y);
说明: 参数x,y为像素点坐标。
函数的返回值可以不反映实际彩色值,这取决于调色板的设置情况(参见tpalette()函数)。
这个函数相应的头文件为graphics.h
返回值: 返回一个像素点色彩值。
例: 把屏幕上(8,6)点的像素颜色值赋给变量color。
color=getpixel(8,6);
没有graphics.h 怎么解决
1、首先看到图中的红色选框中的两个文件夹,将其下载下来。
2、接下来,我们先打开下载的include文件夹,将里面的两个文件,复制下来。
3、接着,找到我们的vs安装的地方,打开VC-include。
4、右键,粘贴。注意,这里配图不是你会出现的,楼主是因为之前已经弄过一次,为了演示才粘贴第二次的。本身并没有这两个文件。
5、接着,我们打开一开始下载的另一个lib文件。
6、将里面的文件,全部选中,复制。
7、同样找到VS安装的地方,VC-lib,粘贴下来。
8、接下来,我们就可以打开我们的VS了。#include <graphics.h>就可以用了。
#include<graphics.h>是什么意思
首先,#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, // cond radial ending point int nYEndArc // cond 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 cond radial's endpoint int nYRadial2 // y-coord of cond 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);
画一个椭圆并填充EllipBOOL Ellip( 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
楼主,我也说老实话,我也是学习中的,希望你可以体谅,我个人认为知识是自己积累的,图像编程也是我希望学习的方面,希望你努力,还有,控件只是工具,不能解决一切问题……你是不是学过VB,如果是你就被VB毒害了……