Einzelnen Beitrag anzeigen

Gilmohr

Registriert seit: 3. Mär 2011
15 Beiträge
 
#30

AW: wer kann helfen und ist aus Hamburg?

  Alt 27. Mär 2011, 04:04
hab das mal selbst in angriff genommen und poste hier mal meinen bisherigen code.


weis ja nicht obs sinn macht hier den ganzen code zu posten, für einige hier sicher eine gute gelegenheit herzhaft zu lachen oder die hände überm kopf zusammenzuschlagen.^^

Delphi-Quellcode:

var
  Form1: TForm1;
  i, j, Reihe, WerkstoffNr: Integer;
  Werkstoff: TStringList;
  Rohrsorten: TStringList;

  Durchmesser, Anzahl: Integer;
  Volumenstrom, Dichte: Real;
  Bauteil: Array[0..2] of String;
  Berechnungen: Array[0..10] of String;
  m, dp, v, d: Array[0..10] of String;
  Werte: Array[0..10] of TStringList;
  Bauteilwahl: Integer;
  Einheit: String;


implementation

{$R *.dfm}

procedure TForm1.ListBox1Click(Sender: TObject);
begin
    case ListBox1.ItemIndex of

    0: begin
          Bauteil[0] := 'Rohr';
          Label3.Caption := 'Rohrlänge:';
          Label4.Caption := 'Meter';
          Memo2.Lines.LoadFromFile ('Bauteile/Rohr.txt');
          ListBox2.Items := Memo2.Lines;
          Memo2.Clear;
          Bauteilwahl := 0;
        end;

    1: begin
          Bauteil[1] := 'Bogen';
          Label3.Caption := 'Anzahl Bögen:';
          Label4.Caption := 'Stück';
          Memo2.Lines.LoadFromFile ('Bauteile/Bogen.txt');
          ListBox2.Items := Memo2.Lines;
          Memo2.Clear;
          Bauteilwahl := 1;
        end;

    2: begin
          Bauteil[2] := 'Ventil';
          Label3.Caption := 'Anzahl Ventile:';
          Label4.Caption := 'Stück';
          Memo2.Lines.LoadFromFile ('Bauteile/Ventil.txt');
          ListBox2.Items := Memo2.Lines;
          Memo2.Clear;
          Bauteilwahl := 2;
        end;
    end;
end;

procedure TForm1.ComboBox2Change(Sender: TObject);
begin
  case ComboBox2.ItemIndex of
    0: Durchmesser := 15;
    1: Durchmesser := 20;
    2: Durchmesser := 25;
  end;
  Edit1.SetFocus;
end;

procedure TForm1.Edit1Change(Sender: TObject);
begin
  Anzahl := StrToInt (Edit1.Text);
end;

procedure TForm1.ListBox2Click(Sender: TObject);
begin

  WerkstoffNr := ListBox2.ItemIndex;
  ComboBox2.SetFocus;
  Werkstoff := TStringList.Create;
  Werkstoff.LoadFromFile ( 'Bauteile/'+Bauteil[Bauteilwahl]+'.txt');
end;

procedure TForm1.Button2Click(Sender: TObject);

begin
  //if Reihe <=0 then Reihe := 0;
  //inc (Reihe);
  Einheit := Label4.Caption;
  //Memo1.Lines.Add( IntToStr(Anzahl)+' '+Einheit+' '+Werkstoff.Strings[WerkstoffNr]+'-'+Bauteil[Bauteilwahl]+' DN '+IntToStr(Durchmesser));
  //Edit2.Text := intToStr(Reihe);


  Werte[j] := TStringList.Create;
  Werte[j].LoadFromFile ( 'R-Werte/'+Bauteil[Bauteilwahl]+'-'+Werkstoff.Strings[WerkstoffNr]+'-'+IntToStr(Durchmesser)+'.txt');
  m[j] := Werte[j].Strings[0];
  dp[j] := Werte[j].Strings[1];
  v[j] := Werte[j].Strings[2];
  d[j] := IntToStr(Durchmesser);
  StringGrid1.RowCount := j+1;
  StringGrid1.Cells[0,j] := IntToStr(Anzahl)+' ' ;
  StringGrid1.Cells[1,j] := Einheit+' ' ;
  StringGrid1.Cells[2,j] := Werkstoff.Strings[WerkstoffNr]+'-'+Bauteil[Bauteilwahl] ;
  StringGrid1.Cells[3,j] := ' DN '+ d[j]; //IntToStr(Durchmesser) ;
  StringGrid1.Cells[4,j] := m[j];
  StringGrid1.Cells[5,j] := dp[j];
  StringGrid1.Cells[6,j] := v[j];
  j := j +1;
  //Edit2.Text := intToStr(j)+'row';
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Dichte := 1000;
  Reihe := 0;
  i := 0;
  j := 0;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
  //Memo1.lines.delete(Reihe-1);
  //dec (Reihe);
  //if Reihe <=0 then Reihe := 0;
  //Edit2.Text := intToStr(j)+'row';

  j := j-1 ;
  StringGrid1.RowCount := j;
  if j <=0 then j := 0;
  if j = 0 then begin
  StringGrid1.Cells[0,j] := ' ' ;
  StringGrid1.Cells[1,j] := ' ' ;
  StringGrid1.Cells[2,j] := ' ' ;
  StringGrid1.Cells[3,j] := ' ' ;
  StringGrid1.Cells[4,j] := ' ' ;
  StringGrid1.Cells[5,j] := ' ' ;
  StringGrid1.Cells[6,j] := ' ' ;

  end;
end;

procedure TForm1.Edit2Change(Sender: TObject);
begin
  Volumenstrom := StrToFloat(Edit2.Text);

end;

procedure TForm1.Button1Click(Sender: TObject);

var a: integer;

begin
  StringGrid2.Cells[i,j] := ' ';
  a := 0 ;
    repeat
    v[a] := FloatToStr((Volumenstrom * 4) / ( StrToInt(d[a]) * 3.1416 * 1000 ));
    StringGrid2.Cells[0,a] := v[a] ;
    //memo1.Lines.add(v[a]) //letzte klammer weg wenn nachfolgendes dazu soll + ' - j= ' +intToStr(j)+' - a= '+intToStr(a));
    inc (a);
    until
    a = j

end;

end.

Geändert von mkinzler (27. Mär 2011 um 14:29 Uhr) Grund: Code-Tag durch Delphi-Tag ersetzt
  Mit Zitat antworten Zitat