Delphi-Quellcode:
type
TForm1 =
class(TForm)
...
TDingsThread =
class(TThread)
private
FParameter: Integer;
protected
procedure Execute;
override;
public
constructor Create(Parameter: Integer);
end;
var
Form1: TForm1;
MyDings: TDingsThread;
implementation
{$R *.dfm}
constructor TDingsThread.Create(Parameter: Integer);
begin
inherited Create(true);
// Create thread as suspended
FreeOnTerminate := True;
// Yes
Priority := tpNormal;
// the priority
FParameter := Parameter;
Resume;
// Start the thread
end;
procedure TDingsThread.Execute;
begin
// Irgendetwas := //Parameter;
while not Terminated
do
begin
With Form1.PaintBox1
do
begin
Canvas.Lock;
Canvas.Pen.Color :=
RGB(Random(255), Random(255), Random(255));
Canvas.Brush.Color :=
RGB(Random(255), Random(255), Random(255));
Canvas.Ellipse(Random(Width), Random(Height),
Random(Width), Random(Height));
Canvas.Unlock;
end;
if not Terminated
then Sleep(33);
end;
end;
// ----------------------------------------------------------------------
procedure TForm1.FormCreate(Sender: TObject);
begin
MyDings := TDingsThread.Create(0);
end;
So könnte ich mir das Vorstellen.
Bin mir aber nicht 100 % sicher.