break;
}
else
Selection=NONE;
}
if(kbhit()) break;
}
Xorbar(tm->x+3,tm->y1+6+i*20,tm->x+97,tm->y1+22+i*20,14);
}
}
}
PullMenuUp(n,tm);
}
MouseOn1(int cx,int cy,int cx1,int cy1)
{
int flag;
flag=0;
if(x>=cx && x<=cx1 && y>=cy && y<=cy1) flag=1;
return flag;
}
/* Mouse & win routines */
union REGS i,o;
struct SREGS ss;
/* 显示鼠标光标函数 */
void Show()
{
i.x.ax=1;
int86(0x33,&i,&o);
}
/* 隐藏鼠标光标函数*/
void Hide()
{
i.x.ax=2;
int86(0x33,&i,&o);
}
/* 获得鼠标状态函数 */
void Status()
{
i.x.ax=3;
int86(0x33,&i,&o);
button=o.x.bx;
x=o.x.cx;
y=o.x.dx;
}
/*绘制菜单项的背景和边框*/
winp(struct MENU *t,int state)
{
Hide();
/*非高亮模式*/
if(state==1)
{
/*两条暗边框线*/
setcolor(0);
line(t->x,t->y,t->x,t->y1);
line(t->x,t->y,t->x1,t->y);
/*两条亮边框线*/
setcolor(15);
line(t->x1,t->y,t->x1,t->y1);
line(t->x,t->y1,t->x1,t->y1);
}
/*高亮模式*/
else
{
/*两条亮边框线*/
setcolor(15);
line(t->x,t->y,t->x,t->y1);
line(t->x,t->y,t->x1,t->y);
/*两条暗边框线*/
setcolor(0);
line(t->x1,t->y,t->x1,t->y1);
line(t->x,t->y1,t->x1,t->y1);
}
Show();
}
/*绘制一个矩形区域*/
Win(int sx,int sy,int ex,int ey)
{
Hide();
/*设置填充的颜色*/
setfillstyle(1,7);
/*绘制一个区域*/
bar(sx,sy,ex,ey);
/*两条亮边框线*/
setcolor(15);
line(sx,sy,sx,ey);
line(sx,sy,ex,sy);
/*两条暗边框线*/
setcolor(0);
line(ex,sy,ex,ey);
line(sx,ey,ex,ey);
Show();
}
Msg(char *m)
{
int l;
setcolor(14);
rectangle(18,438,622,477);
setfillstyle(1,0);
bar(20,440,620,475);
if(MouseOn(&Neeraj))
{
settextstyle(2,0,7);
setcolor(11);
l=textwidth(m)/2;
outtextxy(320-l,440,m);
}
else
{
settextstyle(2,0,8);
setcolor(15);
l=textwidth(m)/2;
outtextxy(320-l,440,m);
outtextxy(321-l,441,m);
}
}
Comments()
{
setfillstyle(1,0);
bar(140,5,500,40);
setcolor(14);
rectangle(140,5,500,40);
settextstyle(2,0,8);
setcolor(15);
outtextxy(260,10,"GUI-MENUS");
setfillstyle(1,8);
bar(140,150,502,402);
setcolor(14);
rectangle(138,148,502,402);
Msg("Welcome !");
settextstyle(2,0,5);
setcolor(10);
outtextxy(158,180,"Hello Friends !");
settextstyle(2,0,4);
outtextxy(260,200,"Here i am with my menu program.");
outtextxy(158,220,"As you can see it's like windows menu,you can");
outtextxy(158,240,"add more menus to it. It's just a concept for");
outtextxy(158,260,"building more menus. I hope you will like my effort,");
outtextxy(158,280,"email me at : n21@indiatimes.com");
setcolor(14);
outtextxy(370,300,"- Neeraj Sharma");
line(380,304+textheight("A"),380+textwidth("Neeraj Sharma"),304+textheight("A"));
}
End()
{
int i,j;
setcolor(0);
Hide();
for(j=0;j<40;j++)
{
for(i=0;i<481;i+=20)
line(0,0+i+j,640,j+0+i);
delay(100);
if(kbhit()) if(getch()==27) break;
}
settextstyle(2,0,5);
setcolor(15);
outtextxy(220,180,"Thanks for being with us !");
Show();
delay(3000);
}c语言课程设计_菜单设计,菜单设计