|
Draw random ellipse using random colors.

Download this example
Use following timer event to draw random ellipse using random colors.
procedure
TForm1.Timer1Timer(Sender: TObject);
begin
Form1.Canvas.Brush.Color:=Random(DColor);
Form1.Canvas.Pen.Color:=Random(DColor);
Form1.Canvas.Ellipse(Random(X),Random(Y),Random(X),Random(Y));
end;
Set
up the initial variable as follows
procedure
TForm1.FormCreate(Sender: TObject);
begin
X:=Form1.Width;
Y:=Form1.Height;
DColor:=1000000;
end;
Set
FormResize event to change X and Y coordinates
procedure
TForm1.FormResize(Sender: TObject);
begin
X:=Form1.Width;
Y:=Form1.Height;
end;
DOWNLOAD this example
Click
here
to download this complete example for Delphi 6. (File size 3KB)

|