wollte Euch mal meine Lösung zeigen, schreibt direkt auf die Form.
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 =
class(TForm)
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
TSnow =
class(TThread)
private
procedure setPixel;
protected
procedure execute;
override;
end;
var
Form1: TForm1;
snow1,snow2: TSnow;
implementation
{$R *.dfm}
procedure TSnow.setPixel;
var
x,y : Integer;
r,g,b: Byte;
begin
x := random(Form1.Width);
y := random(Form1.Height);
r := random(256);
g := random(256);
b := random(256);
Form1.Canvas.Pixels[x,y]:=
RGB(r,g,b);
end;
procedure TSnow.execute;
begin
while not terminated
do
begin
synchronize(setPixel);
end;
end;
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
snow1.Terminate;
snow2.Terminate;
snow1.Free;
snow2.Free;
end;
begin
randomize;
snow1 := TSnow.create(false);
snow2 := TSnow.Create(false);
end.
lustiger wird es wenn man nicht nur von einem Pixel die Farbe ändert
sonder von [x-1,y], [x,y], [x+1,y], [x,y-1], [x,y], [x,y+2]
Grüße
Klaus