Hat mir echt gut gefallen, Delphi mochte das nur leider nicht, Dejan Vu... Naja, neuer Versuch
Delphi-Quellcode:
procedure TForm1.B_StartClick(Sender: TObject);
var i, rAnzahl, rVerzogerung, x,y, rDicke :integer;
begin
randomize ;
rAnzahl:= StrToInt (E_Anzahl.Text);
rVerzogerung:= StrToInt (E_Pause.Text);
For i:=1 To rAnzahl do
begin
x:= random (800);
y:= random (800);
rDicke:= random (30);
IF C_blau.Checked then
begin
Canvas.Brush.Color:= clblue or random (8000000);
end
ELSE
begin
IF C_Gelb.Checked then
begin
Canvas.Brush.Color:= clyellow or random (8000000);
end
ELSE
begin
IF C_gruen.Checked then
begin
Canvas.Brush.Color:= clgreen or random (8000000);
end
ELSE
IF C_blau.Checked then
begin
Canvas.Brush.Color:= clblue or random (8000000);
end
ELSE
begin
IF C_pink.Checked then
begin
Canvas.Brush.Color:= clfuchsia or random (8000000);
end
ELSE
begin
IF C_red.Checked then
begin
Canvas.Brush.Color:= clred or random (8000000);
end
ELSE
begin
IF C_ighlight.Checked then
begin
Canvas.Brush.Color:= clskyblue or random (800000);
end
ELSE
begin
IF C_teal.Checked then
begin
Canvas.Brush.Color:= clteal or random (8000000);
end
ELSE
begin
IF C_navy.Checked then
begin
Canvas.Brush.Color:= clteal or random (8000000);
end
ELSE
begin
Canvas.Brush.Color:= clblack;
end;
end;
end;
end;
end;
end;
end;
end;
Canvas.Ellipse(x,y, x+rDicke, y+rDicke) ;
sleep (rVerzogerung);
end;
end;
procedure TForm1.B_ClearClick(Sender: TObject);
begin
refresh;
E_Anzahl.Text:= ' ';
E_Pause.Text:= ' ';
end;
end.
-------------------------
Delphi-Quellcode:
procedure TForm1.B_DrawClick(Sender: TObject);
begin
Randomize;
If rbW.checked = true Then
Form1.Image1.Canvas.Pen.Color:=clWhite
Else If rbB.Checked = true Then
Form1.Image1.Canvas.Pen.Color:=clBlack
Else If rbY.Checked = true Then
Form1.Image1.Canvas.Pen.Color:=clYellow
Else If rbG.Checked = true Then
Form1.Image1.Canvas.Pen.color:=clGreen
Else If rbBl.Checked = true Then
Form1.Image1.Canvas.Pen.Color:=clNavy
Else If rbR.Checked = true Then
Form1.Image1.Canvas.Pen.Color:=clRed;
If RadioButton2.Checked = true Then
Form1.Image1.Canvas.Brush.Color:= Form1.Image1.Canvas.Pen.Color;
x:= (Random(Form1.Image1.ClientWidth));
y:= (Random(Form1.Image1.ClientHeight));
a:= (Random(Image1.ClientWidth-x));
b:= (Random(Image1.ClientHeight-y));
Form1.Image1.Canvas.Rectangle(x,y,x+a,y+b);
end;
procedure TForm1.B_EmtptyClick(Sender: TObject);
begin
Image1.Picture:= nil;
end;
procedure TForm1.B_BackroundClick(Sender: TObject);
begin
If rbW.checked = true Then
Form1.Image1.Canvas.Brush.Color:=clWhite
Else If rbB.Checked = true Then
Form1.Image1.Canvas.Brush.Color:=clBlack
Else If rbY.Checked = true Then
Form1.Image1.Canvas.Brush.Color:=clYellow
Else If rbG.Checked = true Then
Form1.Image1.Canvas.Brush.color:=clGreen
Else If rbBl.Checked = true Then
Form1.Image1.Canvas.Brush.Color:=clNavy
Else If rbR.Checked = true Then
Form1.Image1.Canvas.Brush.Color:=clRed;
Form1.Image1.Canvas.Rectangle(0,0,Image1.Width,Image1.Height);
end;
end.