background image

    line(210,120,320,0);

line(215,115,320,0);
line(425,120,320,0);
line(420,115,320,0);

outtextxy(290, 310, "亮光表业");

// 绘制刻度
int x, y;
for (int i=0; i<60; i++)
{

x = 320 + int(145 * sin(PI * 2 * i / 60));
y = 240 + int(145 * cos(PI * 2 * i / 60));

if (i % 15 == 0)

bar(x - 5, y - 5, x + 5, y + 5);

else if (i % 5 == 0)

circle(x, y, 3);

else

putpixel(x, y, WHITE);

}

}

void main()
{

initgraph(640,480);

// 

 

初始化 640 x 480 的绘图窗口

DrawDial();

// 绘制表盘

setwritemode(R2_XORPEN);// 

 

设置 XOR 绘图模式

// 绘制表针
SYSTEMTIME ti;

// 定义变量保存当前时间

while(!kbhit())

// 按任意键退出钟表程序

{

GetLocalTime(&ti);

// 获取当前时间

DrawHand(ti.wHour, ti.wMinute, ti.wSecond);

// 画表针

Sleep(1000);

// 

 

延时 1 秒

DrawHand(ti.wHour, ti.wMinute, ti.wSecond);

// 擦表针(擦表针和画表针的过程

是一样的)

}

closegraph();

// 关闭绘图窗口