Forum > Russian

Появление и исчезание фигур на форме в Лазарусе

(1/1)

Mihail90:
Здравствуйте программисты, помогите пожалуйста. Нужна программа, в которой должен к примеру появляться на форме прямоугольник, который выдвигается из правого края формы, двигаться до левого края и заходить за него, далее появляется новый и также движется, интервал появления между прямоугольниками должен быть разный. Вот такая задача, помогите пожалуйста с ней.

Handoko:
Hello Mihail90,
Welcome to the forum.

Translated using Google Translator:

--- Quote ---Hello programmers, help please. You need a program that, for example, should have a rectangle appearing on the form that extends from the right side of the form, move to the left edge and go behind it, then a new one appears and also moves, the interval of appearance between the rectangles should be different. Here such task, help or assist please with her.
--- End quote ---

Something like this below? You can download the test.zip for testing.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, StdCtrls, ExtCtrls; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    Timer1: TTimer;    procedure Button1Click(Sender: TObject);    procedure FormPaint(Sender: TObject);    procedure Timer1Timer(Sender: TObject);  end; var  Form1: TForm1;  PosX: Integer = 350;  Animating: Boolean = False; implementation {$R *.lfm} { TForm1 } procedure TForm1.Timer1Timer(Sender: TObject);begin  Form1.Invalidate;end; procedure TForm1.Button1Click(Sender: TObject);begin  case Animating of    True:  Button1.Caption := 'Click to resume';    False: Button1.Caption := 'Click to pause';  end;  Animating := not(Animating);  Timer1.Enabled := Animating;end; procedure TForm1.FormPaint(Sender: TObject);begin  if not(Animating) then Exit;  Canvas.Brush.Color := clForm;  Canvas.Clear;  Canvas.Rectangle(PosX, 130, PosX + 20, 150);  Dec(PosX, 8);  if (PosX < -30) then PosX := Width + Random(1000);end; end.

Mihail90:
Many thanks :D!!!

Navigation

[0] Message Index

Go to full version