Cita:
Empezado por kuan-yiu
Código Delphi [-]case CB1 of
1: Gra:=StrToFloatDef(Edit1.Text,0) * 10 /100;
2: Gra:=StrToFloatDef(Edit1.Text,0) * 8 /100;
else
Gra:=1; end;
Label5.Text:=FloattoStr(Gra);
Hc:=(Gra * 60 )/100;
Cm:=(Gra * 20) /100;
Ov:=(Gra * 10) /100;
Fv:=(Gra * 5) /100;
Sn:=(Gra * 5) /100;
Label9.Text:=FloattoStr(Hc) ;
Label10.Text:=FloattoStr(Cm) ;
Label11.Text:=FloattoStr(Ov) ;
Label12.Text:=FloattoStr(Fv) ;
Label13.Text:=FloattoStr(Sn) ;
|
asi quedo al final
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
begin
CB1:=combobox1.ItemIndex+1;
case CB1 of
1: begin Gra:=StrToFloatDef(Edit1.Text,0) * 10 /100;
end;
2: begin Gra:=StrToFloatDef(Edit1.Text,0) * 8 /100;
end;
3:begin Gra:=StrToFloatDef(Edit1.Text,0) * 6 /100;
end;
4: begin Gra:=StrToFloatDef(Edit1.Text,0) * 4 /100;
end;
5: begin Gra:=StrToFloatDef(Edit1.Text,0) * 3 /100;
end;
6: begin Gra:=StrToFloatDef(Edit1.Text,0) * 2 /100;
end;
7: begin Gra:=StrToFloatDef(Edit1.Text,0) * 4 /100;
end;
8: begin Gra:=StrToFloatDef(Edit1.Text,0) * 3 /100;
end;
9: begin Gra:=StrToFloatDef(Edit1.Text,0) * 2.5 /100;
end;
10: begin Gra:=StrToFloatDef(Edit1.Text,0) * 2.5 /100;
end;
11: begin Gra:=StrToFloatDef(Edit1.Text,0) * 2 /100;
end else
Gra:=1;
end;
Label5.Text:=FloattoStr(Gra);
Hc:=(Gra * 60 )/100;
Cm:=(Gra * 20) /100;
Ov:=(Gra * 10) /100;
Fv:=(Gra * 5) /100;
Sn:=(Gra * 5) /100;
Label9.Text:=FloattoStr(Hc) ;
Label10.Text:=FloattoStr(Cm) ;
Label11.Text:=FloattoStr(Ov) ;
Label12.Text:=FloattoStr(Fv) ;
Label13.Text:=FloattoStr(Sn) ;
end;
se podra hacer mas compacto??????