彩色按钮的显示程序

彩色按钮的显示程序

这是一个彩色按钮的显示程序,运行时需要有BGI驱动程序

#include<dos.h>
#include<stdio.h>
#include<process.h>
#include<conio.h>
#include<graphics.h>
void InitGraph();
void Quit();
void ThreeDBx(int,int,int,int);
void ChgColor(int,int,int,int);

int main()
{
InitGraph();
ChgColor(1,0,60,60);
ChgColor(2,0,30,30);
ChgColor(3,0,45,45);
ChgColor(7,36,36,36);
setfillstyle(1,7);bar(0,0,639,479);
ThreeDBx(140,25,360,430);
getch();
Quit();
return 0;
}

void InitGraph()
{
int GraphDriver=DETECT,GraphMode;

initgraph(&GraphDriver,&GraphMode,"");
}

void Quit()
{
closegraph();
exit(0);
}

void ThreeDBx(int x,int y,int l,int h)
{
int i;
setcolor(2);
rectangle(x,y,x+l,y+h);
setfillstyle(1,2);
bar(x+1,y+1,x+l-1,y+h-1);
setcolor(1);
for(i=0;i<6;i++){
line(x+i,y+i,x+l-i,y+i);
line(x+i,y+i,x+i,y+h-i);
}
setfillstyle(1,3);bar(x+6,y+6,x+l-6,y+h-6);
line(x+l-1,y+h-1,x+l-6,y+h-6);
setcolor(2);line(x+1,y+1,x+6,y+6);
setcolor(1);rectangle(x+20,y+20,x+l-20,y+h-20);
setcolor(2);rectangle(x+19,y+19,x+l-21,y+h-21);
}

void ChgColor(int ColorNo,int Red,int Green,int Blue)
{
union REGS In;
In.x.ax=0x1010;
In.x.bx=ColorNo;
In.h.dh=Red;
In.h.ch=Green;
In.h.cl=Blue;
int86(0x10,&In,&In);
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值