#include<graphics.h>
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
#include"Win_Mous.cpp"// Needed for mouse & window functions, included in zipvoid main()
{
int x,y,b,e=1,ok=0;
G();
setfillstyle(1,3);
bar(0,0,639,479);
Win("Check-Box",100,50,450,400,1);
checkcircle(200,100);
checkcircle(200,150);
checkcircle(200,200);
checkbox(150,100);
checkbox(150,150);
checkbox(150,200);
setcolor(0);
outtextxy(240,100,"Option 1");
outtextxy(240,150,"Option 2");
outtextxy(240,200,"Option 3");
// outtextxy(150,250,"left button : check & uncheck");
checkc(200,100,1);
Button("Ok",240,330,290,350,DRAW);
showmouse();
do
{
if(kbhit()) {if(getch()==27) e=0;}
getmouse(&b,&x,&y);
if((b&1)==1)
{
if(x>=240 && x<=290 && y>=330 && y<=350)// ok
{
e=0;
}
if(x>=150 && x<=160 && y>=100 && y<=110)
{
if(ok==0) ok=1;
elseif(ok==1) ok=0;
hidemouse();
setfillstyle(1,7);
bar(150,100,160,110);
showmouse();
while((b&1)==1)
getmouse(&b,&x,&y);
hidemouse();
setfillstyle(1,15);
bar(150,100,160,110);
check(150,100,ok);
showmouse();
}
if(x>=150 && x<=160 && y>=150 && y<=160)
{
if(ok==0) ok=1;
elseif(ok==1) ok=0;
hidemouse();
check(150,150,ok);
showmouse();
}
if(x>=150 && x<=160 && y>=200 && y<=210)
{
if(ok==0) ok=1;
elseif(ok==1) ok=0;
hidemouse();
check(150,200,ok);
showmouse();
}
if(x>=200 && x<=210 && y>=100 && y<=110)
{
hidemouse();
checkc(200,100,1);
checkc(200,150,0);
checkc(200,200,0);
showmouse();
}
if(x>=200 && x<=210 && y>=150 && y<=160)
{
hidemouse();
checkc(200,100,0);
checkc(200,150,1);
checkc(200,200,0);
showmouse();
}
if(x>=200 && x<=210 && y>=200 && y<=210)
{
hidemouse();
checkc(200,100,0);
checkc(200,150,0);
checkc(200,200,1);
showmouse();
}
while((b&1)==1)
getmouse(&b,&x,&y);
}
}while(e);
hidemouse();
closegraph();
}