Einzelnen Beitrag anzeigen

Popov
(Gast)

n/a Beiträge
 
#19

AW: Fehlermeldung "zugewiesener Wert wird niemals benutzt"?

  Alt 19. Mai 2015, 19:02
Nennt mich altmodisch, nicht mehr zeitgemäß, analfixiert, aber ein unformatierter Code tut mir in den Augen weh. Wie soll man da verstehen was das Programm macht?
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;
Oder noch anders. Wozu die nagen Begins und Ends?
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
      Canvas.Brush.Color := clblue or random (8000000)
    else if C_Gelb.Checked then
      Canvas.Brush.Color := clyellow or random (8000000)
    else if C_gruen.Checked then
      Canvas.Brush.Color := clgreen or random (8000000)
    else if C_blau.Checked then
      Canvas.Brush.Color := clblue or random (8000000)
    else if C_pink.Checked then
      Canvas.Brush.Color := clfuchsia or random (8000000)
    else if C_red.Checked then
      Canvas.Brush.Color := clred or random (8000000)
    else if C_ighlight.Checked then
      Canvas.Brush.Color := clskyblue or random (800000)
    else if C_teal.Checked then
      Canvas.Brush.Color := clteal or random (8000000)
    else if C_navy.Checked then
      Canvas.Brush.Color := clteal or random (8000000)
    else
      Canvas.Brush.Color:= clblack;

    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;
  Mit Zitat antworten Zitat