1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
   |  
uses Math;
 
procedure TForm1.Timer1Timer(Sender: TObject);
const 
  PointsCount=5;
var 
  R1, R2:HRGN;
  P: array[0..PointsCount-1] of Tpoint;
  S, C, S20, C20, S50, C50: Extended;
begin
  // devrait être délocalisé à l'assignation d'Alpha 
  // 1 seul calcul SinCos donc plus de performance
  SinCos(Alpha, S, C);
  S20 := 20*S;
  C20 := 20*C;
  S50 := 50*S;
  C50 := 50*C;
  // ---------------
 
  P[0].X:=round(x+C20);
  P[0].Y:=round(y+S20);
  P[1].X:=round(x-30*S);
  P[1].Y:=round(y+30*C);
  P[2].X:=round(x-C20);
  P[2].Y:=round(y-S20) ;
  P[3].X:=round(x-C20+S50);
  P[3].Y:=round(y-C50-S20);
  P[4].X:=round(x+C20+S50);
  P[4].Y:=round(y-C50+S20);
 
  Canvas.Brush.Color:=$9C0000;
  R1 := CreateRectRgn(1, 1, TEdForcevent.Left-5, height);
  canvas.FillRect(1,1,TEdForcevent.Left-5,height);
  R2 := CreatePolygonRgn(PPoint(@P), PointsCount, WINDING);
 end;  | 
Partager