ΪʲôССµÄ³ÌÐòÔËÐÐÈ´³¬ÂýÄØ£¿£¿£¿
//////////////////////////////Èý½ÇÐλ°å£¬¿ÉÑ¡ÈýÖÖÑÕÉ«
//»ÍêÈý½ÇºóµãÑÕÉ«¿ÉÒÔ»»Ìî³äÉ«
/////////////////////////////
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
int main(void)
{
initgraph(300,480);
setbkcolor(WHITE);
cleardevice();//ÉèÖñ³¾°
//»æÖÆÑ¡É«Çø
setfillcolor(RED);
fillrectangle(0,450,100,480);
setfillcolor(YELLOW);
fillrectangle(100,450,200,480);
setfillcolor(BLUE);
fillrectangle(200,450,300,480);
MOUSEMSG o;
int color;
char yanse;
while(!kbhit())
{
while(!MouseHit())
{
if(true)
{
//µã»÷Êó±êÑ¡ÔñÑÕÉ«
o=GetMouseMsg();
if(o.uMsg==WM_LBUTTONDOWN)
{
if((o.x>=0&&o.x<=100)&&(o.y>=450&&o.y<=480)) yanse='R';
else if((o.x>=100&&o.x<=200)&&(o.y>=450&&o.y<=480)) yanse='Y';
else if((o.x>=200&&o.x<=300)&&(o.y>=450&&o.y<=480)) yanse='B';
else 0;
switch(yanse)
{
case'R': color=RED; break;
case'Y': color=YELLOW; break;
case'B': color=BLUE; break;
default: 0;
}
setfillcolor(color);//
}
}
}
fillcircle(10,10,10);//µ±Ç°ÑÕÉ«±êʾ·û
//»æÖÆÈý½ÇÐÎ
POINT p[3];
int i;
MOUSEMSG m;
for(i=0;i<3;)
{
if(true)
m=GetMouseMsg();
if(m.uMsg==WM_LBUTTONDOWN)
{
p[i].x = m.x;
p[i].y = m.y;
i++;
}
}
solidpolygon(p,3);
}
return 0;
getch();
closegraph();
}