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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
var
P: TPoint;
W: Integer;
H: Integer;
B: TBitmap;
procedure TForm1.FormCreate(Sender: TObject);
var
m: Integer;
begin
m := 0;
if Screen.MonitorCount > 0 then
m := 1;
BorderStyle := bsNone;
Color := clBlack;
B := TBitmap.Create;
with Screen.Monitors[m] do
begin
SetBounds(Left, Top, Width, Height);
W := Width div 2;
H := Height div 2;
B.Width := Width;
B.Height := Height;
end;
with B.Canvas do
begin
Brush.Color := clBlack;
Rectangle(0, 0, B.Width, B.Height);
end;
end;
procedure TForm1.FormPaint(Sender: TObject);
var
T: Single;
N: TPoint;
begin
T := GetTickCount/1000;
N.X := W + Round(W * Cos(T) * Sin(T));
N.Y := H + Round(H * Sin(T) * Sin(2*T));
with B.Canvas do
begin
Brush.Color := clWhite;
Pen.Color := clWhite;
Rectangle(N.X - 5, N.Y - 5, N.X + 5, N.Y + 5);
end;
Canvas.Draw(0, 0, B);
with B.Canvas do
begin
Brush.Color := clBlack;
Pen.Color := clBlack;
Rectangle(P.X - 5, P.Y - 5, P.X + 5, P.Y + 5);
end;
P := N;
InvalidateRect(Handle, nil, False);
end; |