| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 479 人关注过本帖
标题:求助!图形做图问题!
只看楼主 加入收藏
梦想中国
Rank: 2
等 级:新手上路
威 望:5
帖 子:539
专家分:0
注 册:2006-2-26
收藏
 问题点数:0 回复次数:3 
求助!图形做图问题!

高人好:请高人帮我看看为什么我的程序不做图啊!
我的程序是在屏幕上首先绘制100个空方块,然后将100个空方块填充为颜色2的颜色,为什么不填充啊!
#include<graphics.h>
#include<conio.h>
struct FF{
int left,top,right,bottom;
};
struct FF graph={200,200,400,400};
struct FF dot[11][11];
void draw_graph(struct FF *g);
void draw_dot(struct FF dot[11][11]);
int main(void)
{
int gdriver=DETECT,gmode;
clrscr();
initgraph(&gdriver,&gmode,"c:\\tc");
draw_graph(&graph);
draw_dot(dot);
getch();
closegraph();
return 0;
}
void draw_graph(struct FF *g) file://绘制空方块
{
int i;
setcolor(3);
rectangle(g->left,g->top,g->right,g->bottom);
for(i=1;i<=10;i++)
{
line(g->left,g->top+i*20-20,g->right,g->top+i*20-20);
line(g->left+i*20-20,g->top,g->left+i*20-20,g->bottom);
}
}
void draw_dot(struct FF dot[11][11]) //填充函数
{
int i,j,k,m,n;
for(k=1;k<=10;k++) //set every line first element
{
dot[k][1].left=200;
dot[k][1].top=200+k*20-20;
dot[k][1].right=220;
dot[k][1].bottom=220+k*20-20;
}
for(i=1;i<=10;i++)
{
for(j=2;j<=10;j++)
{
dot[i][j].left=dot[i][j-1].left+20;
dot[i][j].top=dot[i][j-1].top;
dot[i][j].right=dot[i][j-1].right+20;
dot[i][j].bottom=dot[i][j-1].bottom;
}
}
setfillstyle(1,2);
for(m=1;m<=10;m++)
{
for(n=1;n<=10;n++)
{
bar(dot[i][j].left,dot[i][j].top,dot[i][j].right,dot[i][j].bottom);
}
}
}

搜索更多相关主题的帖子: 填充 include bottom 
2006-03-04 19:30
梦想中国
Rank: 2
等 级:新手上路
威 望:5
帖 子:539
专家分:0
注 册:2006-2-26
收藏
得分:0 
此问题已经解决

2006-03-04 19:59
cordier
Rank: 2
等 级:论坛游民
威 望:1
帖 子:449
专家分:14
注 册:2006-2-9
收藏
得分:0 
我感觉你画的太密了,
如果你的方格是20*20,我觉得画一个18*18的,那边缘的线会呈现出来。
另外我觉得那些可以不用二维数组的,可能left,right,top,bottom就可以了。
我指的是可能。

2006-03-05 08:35
moon
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2006-3-5
收藏
得分:0 
.......

有意思~~
initgraph(&gdriver,&gmode,"c:\\tc");

从来没看过!
initgraph(&gdriver,&gmode,"\\bgi");

ARM+LINUX嵌入式   -月满西楼
2006-03-05 15:32
快速回复:求助!图形做图问题!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019561 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved