| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1013 人关注过本帖
标题:有 人用c写了窗口界面代码,我现在用wxWidgets-2.8.6 做dvcpp的图形库,可以 ...
只看楼主 加入收藏
stststst
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2007-8-7
收藏
 问题点数:0 回复次数:0 
有 人用c写了窗口界面代码,我现在用wxWidgets-2.8.6 做dvcpp的图形库,可以实现么

如题,我现 用的是devcpp4.9.9.2和wxWidgets-2.8.6,有朋友会实现下面这个代码实现的画模拟窗口功能么???

#include<graphics.h>
#include<conio.h>
void drawColScrollBarUnAct(int,int,int,int);
void drawRowScrollBarUnAct(int,int,int);
void DrawAreaForScorollBax(int,int,int,int);/*类似setfillstyle(9,7)*/
void drawSmallBox(int,int,int,int);/*画小窗口*/
void drawBigBox(int,int,int,int);
void drawFolder(int,int);/*画文件夹*/
void drawButton(int,int,int,int);/*画按纽*/
void drawDialog(int,int,char[],char[]);/*画WIN2000窗口*/
void main(void)
{
int driver,mode;
driver=DETECT;
initgraph(&driver,&mode,""); /*初始化图形模式*/

cleardevice(); /*以背景颜色为LIGHTDARK清屏*/
setfillstyle(1,15);
bar(0,0,getmaxx(),getmaxy()); /*设置背景颜色为LIGHTDARK*/

drawDialog(100,100,"Open...","Open"); /*调用函数*/

getch(); /*停顿*/

closegraph(); /*关闭图形模式*/
}
void drawDialog(int x,int y,char array[],char array1[])
{
int i,j;

/*画整个窗口的大小*/
setfillstyle(1,7);
bar(x,y,x+300,y+200);
setcolor(15);
line(x+1,y+1,x+300,y+1);
line(x+1,y+1,x+1,y+200);
setcolor(0);
line(x+300,y,x+300,y+200);
line(x,y+200,x+300,y+200);
setcolor(8);
line(x+1,y+199,x+299,y+199);
line(x+299,y+1,x+299,y+199);
setfillstyle(1,1);
bar(x+3,y+2,x+298,y+15);

/*画窗口的右上角的 关闭按纽 和 帮助按纽*/
setfillstyle(1,7);
bar(x+285,y+4,x+295,y+14);
bar(x+272,y+4,x+282,y+14);
setcolor(15);
line(x+285,y+4,x+295,y+4);
line(x+285,y+4,x+285,y+14);
line(x+272,y+4,x+282,y+4);
line(x+272,y+4,x+272,y+14);
setcolor(8);
line(x+295,y+4,x+295,y+14);
line(x+285,y+14,x+295,y+14);
line(x+282,y+4,x+282,y+14);
line(x+272,y+14,x+282,y+14);
setcolor(8);
settextstyle(2,0,4);
moveto(x+274,y+4);
outtext("?");
moveto(x+275,y+4);
outtext("?");
setcolor(15);
for(i=x+288,j=y+6;i<=x+293;i++,j++)
line(i,j,i+1,j);
for(i=x+288,j=y+11;i<=x+293;i++,j--)
line(i,j,i+1,j);
setcolor(8);
for(i=x+287,j=y+6;i<=x+292;i++,j++)
line(i,j,i+1,j);
for(i=x+287,j=y+11;i<=x+292;i++,j--)
line(i,j,i+1,j);

settextstyle(2,0,4);
setcolor(15);
moveto(x+5,y+4);
outtext(array);

/*画显示文件夹的小窗口*/
drawSmallBox(x+35,y+20,x+189,y+37);
/*画文件夹*/
drawFolder(x+37,y+25);
setcolor(0);
settextstyle(2,0,4);
moveto(x+60,y+23);
outtext("music");

/*画显示目录下的文件 或 文件夹 的大窗口*/
drawBigBox(x+35,y+45,x+280,y+145);

/*画写文件名的小窗口*/
drawSmallBox(x+80,y+160,x+225,y+177);
setfillstyle(1,1);
bar(x+82,y+163,x+111,y+174);
setcolor(15);
settextstyle(2,0,4);
moveto(x+83,y+163);
outtext("*.mzc");
setcolor(0);
settextstyle(2,0,4);
moveto(x+35,y+162);
outtext("File(N):");
line(x+62,y+172,x+66,y+172);

/*画按纽*/
drawButton(x+240,y+160,x+282,y+178);
setcolor(0);
settextstyle(2,0,4);
moveto(x+249,y+163);
outtext(array1);
line(x+249,y+172,x+253,y+172);
}
void drawBigBox(int left,int top,int right,int bottom)
{
setfillstyle(1,15);
bar(left,top,right,bottom);
setcolor(0);
line(left,top,right,top);
line(left,top,left,bottom);
setcolor(8);
line(left+1,top+1,right-1,top+1);
line(left+1,top+1,left+1,bottom-1);
setcolor(7);
line(left+1,bottom-1,right-1,bottom-1);
line(right-1,top+1,right-1,bottom-1);
DrawAreaForScorollBax(left+2,bottom-16,right-2,bottom-2);
drawRowScrollBarUnAct(left+2,bottom-16,-1);
drawRowScrollBarUnAct(right-16,bottom-16,1);
}
void drawSmallBox(int left,int top,int right,int bottom)
{
setfillstyle(1,15);
bar(left,top,right,bottom);
setcolor(0);
line(left,top,right,top);
line(left,top,left,bottom);
setcolor(8);
line(left+1,top+1,right-1,top+1);
line(left+1,top+1,left+1,bottom-1);
setcolor(7);
line(left+1,bottom-1,right-1,bottom-1);
line(right-1,top+1,right-1,bottom-1);
drawColScrollBarUnAct(right-16,top+2,right-1,bottom-2);
}
void drawColScrollBarUnAct(int left,int top,int right,int bottom)
{
drawButton(left,top,right,bottom);
setcolor(7);
line(left,top,right-1,top);
line(left,top+1,left,bottom-1);
setcolor(8);
line(left+(right-left)/2,bottom-5,left+(right-left)/2-3,bottom-8);
line(left+(right-left)/2,bottom-5,left+(right-left)/2+3,bottom-8);
line(left+(right-left)/2-3,bottom-8,left+(right-left)/2+3,bottom-8);
setfillstyle(1,8);
floodfill(left+(right-left)/2,bottom-6,8);
setcolor(15);
line(left+(right-left)/2+1,bottom-4,left+(right-left)/2+4,bottom-7);
}
void drawFolder(int left,int top)
{
int i,j;
setfillstyle(1,14);
bar(left,top,left+12,top+9);
setcolor(0);
rectangle(left,top,left+12,top+9);
line(left+1,top-1,left+5,top-1);
setcolor(14);
line(left+1,top,left+5,top);
for(i=left,j=top+9;j>=top+3;j--,i++)
putpixel(i,j,0);
setcolor(0);
line(left+6,top+3,left+18,top+3);
line(left+18,top+3,left+12,top+9);
setcolor(14);
for(i=left+2,j=top+8;j>top+3;j--,i++)
line(i,j,i+10,j);
putpixel(left+18,top+3,15);
}
void drawButton(int left,int top,int right,int bottom)
{
setfillstyle(1,7);
bar(left,top,right,bottom);
setcolor(15);
line(left+1,top+1,left+1,bottom-1);
line(left+2,top+1,right-1,top+1);
setcolor(8);
line(left+1,bottom-1,right-1,bottom-1);
line(right-1,top+1,right-1,bottom-1);
line(left,top,right-1,top);
line(left,top+1,left,bottom-1);
setcolor(0);
line(left,bottom,right,bottom);
line(right,top,right,bottom);
}
void DrawAreaForScorollBax(int left,int top,int right,int bottom) /*类似setfillstyle(9,7)*/
{
int i;

setcolor(15);
for(i=top;i<=bottom;i++)
line(left,i,right,i);

setcolor(7);
for(i=top;i<=bottom;i++)
{
if(left%2==0)
if(i%2==0)
setlinestyle(4,0xaaaa,1);
else
setlinestyle(4,0x5555,1);
else
if(i%2==0)
setlinestyle(4,0x5555,1);
else
setlinestyle(4,0xaaaa,1);
line(left,i,right,i);
}
setlinestyle(0,0,1);
}
void drawRowScrollBarUnAct(int PointerX,int PointerY,int BarStyle)
{
int i;
setcolor(7);
for(i=PointerY;i<=PointerY+14;i++)
line(PointerX,i,PointerX+14,i);
setcolor(15);
line(PointerX+1,PointerY+1,PointerX+13,PointerY+1);
line(PointerX+1,PointerY+1,PointerX+1,PointerY+14);
setcolor(8);
line(PointerX+1,PointerY+14,PointerX+14,PointerY+14);
line(PointerX+13,PointerY+2,PointerX+13,PointerY+14);
setcolor(8);
line(PointerX+14,PointerY+1,PointerX+14,PointerY+14);
if(BarStyle==-1)
{
line(PointerX+5,PointerY+7,PointerX+8,PointerY+4);
line(PointerX+5,PointerY+7,PointerX+8,PointerY+10);
line(PointerX+8,PointerY+4,PointerX+8,PointerY+10);
setfillstyle(1,8);
floodfill(PointerX+7,PointerY+7,8);
setcolor(15);
line(PointerX+9,PointerY+5,PointerX+9,PointerY+11);
}
else if(BarStyle==1)
{
line(PointerX+9,PointerY+7,PointerX+6,PointerY+4);
line(PointerX+9,PointerY+7,PointerX+6,PointerY+10);
line(PointerX+6,PointerY+4,PointerX+6,PointerY+10);
setfillstyle(1,8);
floodfill(PointerX+7,PointerY+7,8);
setcolor(15);
line(PointerX+10,PointerY+8,PointerX+7,PointerY+11);
}
}

[此贴子已经被作者于2007-11-18 8:05:51编辑过]

搜索更多相关主题的帖子: int void 图形 dvcpp 窗口 
2007-11-18 07:59
快速回复:有 人用c写了窗口界面代码,我现在用wxWidgets-2.8.6 做dvcpp的图形库 ...
数据加载中...
 
   



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

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