当前位置: 代码迷 >> C语言 >> 求助:画图程序如何保存图形
  详细解决方案

求助:画图程序如何保存图形

热度:434   发布时间:2007-06-09 16:09:45.0
求助:画图程序如何保存图形

#include<graphics.h>
#include "stdio.h"
#include "stdlib.h"

main()
{
char *v[]={"0.0","0.1","0.2","0.3","0.4","0.5","0.6","0.7","0.8","0.9","1.0"};
char *dmax[]={"25","24","23","22","21","20","19","18","17","16","15"};
float JL[]={18.75,18.43,17.70,20.75,18.73,20.62,21.81,21.01,20.27,18.47,15.66};
float CT[]={18.64,18.34,17.61,20.62,18.62,20.47,21.65,20.87,20.16,18.38,15.58};
int i,j,x,y;
int gr=0;
int gd=VGAHI;
initgraph(&gr,&gd,"d:\\tc\\tc"); /*初始化图形系统*/
cleardevice(); /*清屏*/
setbkcolor(15); /*设置屏幕背景色为白色*/
setviewport(20,20,600,450,0); /*视窗管理函数*/

moveto(80,20+38*(25-JL[0])); /*移动画笔到指定位置*/
for(i=1;i<=10;i++) /*循环画线,显示矩量法结果*/
{
x=80+i*45;
y=20+(25-JL[i])*38;
setcolor(4);
lineto(x,y); /*画直线*/
circle(x,y,2); /*画一圆*/
moveto(x,y);
}

moveto(80,20+38*(25-CT[0])); /*移动画笔到指定位置*/
for(i=1;i<=10;i++) /*循环画线,显示传统法结果*/
{
x=80+i*45;
y=20+(25-CT[i])*38;
setlinestyle(1,0,2); /*设置线型为点画线,两点宽*/
setcolor(2);
lineto(x,y); /*画直线*/
circle(x,y,2); /*画一圆*/
moveto(x,y);
}

setcolor(1); /*设置画笔颜色为蓝色*/
setlinestyle(0,0,1); /*设置线型为实线,一点宽*/
rectangle(80,20,530,400); /*以(80,20),(530,400)画一矩形*/
j=0;
for(i=80;i<=530;i=i+45) /*设置坐标横轴*/
{line(i,400,i,410);
outtextxy(i-4,415,v[j]);
j++;
}
i=0;
for(j=20;j<=400;j=j+38) /*设置坐标纵轴*/
{line(70,j,80,j);
outtextxy(50,j-3,dmax[i]);
i++;
}
setcolor(2);
outtextxy(400,370,"chuantongfa"); /*显示文本chuantongfa*/
setcolor(4);
outtextxy(400,380,"juliangfa"); /*显示文本juliangfa*/
setcolor(1);
outtextxy(540,400,"v(Y/X)"); /*显示文本v(Y/X)*/
settextstyle(0,1,1); /*设置位图字体,自底向上,大小为8*8点阵*/
outtextxy(25,20,"dmax"); /*显示文本dmax*/

}

此程序能运行出结果,但结果不能保存,求助!!!
非常感谢啊!!!
最好能用截屏的方法啊!!!

搜索更多相关的解决方案: 画图  图形  保存  

----------------解决方案--------------------------------------------------------
保存图象结果方法不清楚,但可以用另一种办法:你在你程序后面添加getch();closegraph();运行程序就能看到你的结果.然后用windows的截图方法可以保存结果.呵呵....................比较另类
----------------解决方案--------------------------------------------------------
  相关解决方案