Перемещение случайным образом кнопки при подводе курсора мыши к кнопке на заданное расстояние — Delphi(Делфи)

procedure TForm1.Button1MouseMove(Sender:TObject; ...);
var newx,newy:Integer;
begin
    newx := Random(ClientWidth-Button1.Width);
    newy := Random(ClientHeight-Button1.Height);
    Button1.BoundsRect := Rect(newx, newy, newx+Button1.Width, newy+Buttpn1.Height);
end;

Leave a Comment

− 1 = 2