語法:
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Canvas->Pen->Color=clBlack;
j=-1.57+3.14*hr1/6+(3.14/360*min);
Canvas->Pen->Width=15;
Canvas->MoveTo(x,y);
Canvas->LineTo(x+cos(j)*(r-200),y+sin(j)*(r-200));
j=-1.57+3.14*min1/30;
Canvas->Pen->Width=9;
Canvas->MoveTo(x,y);
Canvas->LineTo(x+cos(j)*(r-150),y+sin(j)*(r-150));
j=-1.57+3.14*sec1/30;
Canvas->Pen->Width=3;
Canvas->MoveTo(x,y);
Canvas->LineTo(x+cos(j)*(r-100),y+sin(j)*(r-100));
// ShowMessage(TimeToStr(Time()).SubString(6,5));
/* DrawBmp((Screen->Width-114)/2,Screen->Height-100,TimeToStr(Time()).SubString(6,1).ToInt());
DrawBmp((Screen->Width-82)/2,Screen->Height-100,TimeToStr(Time()).SubString(7,1).ToInt());
DrawBmp((Screen->Width-50)/2,Screen->Height-100,10);
DrawBmp((Screen->Width-32)/2,Screen->Height-100,TimeToStr(Time()).SubString(9,1).ToInt());
DrawBmp(Screen->Width/2,Screen->Height-100,TimeToStr(Time()).SubString(10,1).ToInt());
DrawBmp((Screen->Width+32)/2,Screen->Height-100,10);
DrawBmp((Screen->Width+50)/2,Screen->Height-100,TimeToStr(Time()).SubString(12,1).ToInt());
DrawBmp((Screen->Width+82)/2,Screen->Height-100,TimeToStr(Time()).SubString(13,1).ToInt()); */
Canvas->Pen->Color=clYellow;
sec=TimeToStr(Time()).SubString(12,2).ToInt();
j=-1.57+3.14*sec/30;
Canvas->Pen->Width=3;
Canvas->MoveTo(x,y);
Canvas->LineTo(x+cos(j)*(r-100),y+sin(j)*(r-100));
min=TimeToStr(Time()).SubString(9,2).ToInt();
j=-1.57+3.14*min/30;
Canvas->Pen->Width=9;
Canvas->MoveTo(x,y);
Canvas->LineTo(x+cos(j)*(r-150),y+sin(j)*(r-150));
hr=TimeToStr(Time()).SubString(6,2).ToInt();
j=-1.57+3.14*hr/6+(3.14/360*min);
Canvas->Pen->Width=15;
Canvas->MoveTo(x,y);
Canvas->LineTo(x+cos(j)*(r-200),y+sin(j)*(r-200));
hr1=hr;
sec1=sec;
min1=min;
}
//---------------------------------------------------------------------------