Для создания часов
lobal $canvas, $x0, $y0, $clearColor, $r, $k, $arrow;
c("Form1")->doubleBuffered = true;
c("image1")->h = c("image1")->w;
$canvas = new TControlCanvas( c("image1") );
$canvas->brush->color = $clearColor = c("Form1")->color;
$canvas->clear();
$x0 = round( c("image1")->w / 2);
$y0 = round( c("image1")->h / 2);
$r = c("image1")->w/2-20;
$k = 16;
dial();
arrows();
function dial(){
global $x0, $y0, $r, $k;
$canvas = new TControlCanvas( c("image1") );
for($i=1; $i<=60; $i++){
$a = deg2rad( $i*6 - 90);
$x1 = $x0 + round( cos($a) * ($r-$k));
$y1 = $x0 + round( sin($a) * ($r-$k));
if( !fmod($i,5)){
$x2 = $x0 + round( cos($a) * ($r + (strlen($i/5)-1)*$canvas->textWidth($i/5)/$k));
$y2 = $x0 + round( sin($a) * ($r + (strlen($i/5)-1)*$canvas->textHeight($i/5)/$k));
$canvas->textOut($x2 - $canvas->textWidth($i/5)/2,$y2 - $canvas->textHeight($i/5)/2,$i/5);
$canvas->ellipse($x1-2,$y1-2,$x1+4,$y1+4);
}else{
$canvas->ellipse($x1-1,$y1-1,$x1+2,$y1+2);
}
}
}
function arrows(){
global $clearColor, $arrow;
arrow("H", 32, 3, $clearColor, $arrow[0]);
arrow("i", 16, 2, $clearColor, $arrow[1]);
arrow("s", 8, 1, $clearColor, $arrow[2]);
arrow("H", 32, 3, clBlack);
arrow("i", 16, 2, clBlack);
arrow("s", 8, 1, clRed);
c("Form1")->caption = "your name".date("H:i:s");
$arrow[0] = date("H"); $arrow[1] = date("i"); $arrow[2] = date("s");
}
function arrow($d="s", $t=0, $s=1, $c=clBlack, $n=0){
global $canvas, $x0, $y0, $r, $k;
if($n){$date = $n;}else{$date = date($d);}
$a = deg2rad($date*6 - 90);
$x1 = $x0 + round( cos($a) * ($r-$t-$k));
$y2 = $x0 + round( sin($a) * ($r-$t-$k));
$canvas->pen->color = $c;
$canvas->pen->width = $s;
$canvas->moveTo($x0, $y0);
$canvas->lineTo($x1, $y2);
}
СРИПТ ДЛЯ ТАЙМЕРА!!!
arrows();