Показать сообщение отдельно
  #9  
Старый 17.03.2013, 13:20
Аватар для Yurk@
Yurk@ Yurk@ вне форума
Специалист
 
Регистрация: 07.09.2007
Адрес: Украина, г. Днепропетровск
Сообщения: 892
Версия Delphi: 7 + ОгнеПтица
Репутация: выкл
По умолчанию

Цитата:
А с таким кодом, что посоветуете?
как вариант
Код:
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
  OnOffTimers(False);
  PBP(0);
  GP();
  Button1.Caption := 'GO!!'; 
  n := StrToInt(ComboBox1.Text);

  ProgressBar1.Visible := n in [2,3,4,5,6,7,8,9,10];
  Gauge1.Visible := n in [2,3,4,5,6,7,8,9,10];
  Label1.Visible := n in [2,3,4,5,6,7,8,9,10];
  ProgressBar2.Visible := n in [2,3,4,5,6,7,8,9,10];
  Gauge2.Visible := n in [2,3,4,5,6,7,8,9,10];
  Label2.Visible := n in [2,3,4,5,6,7,8,9,10];
  //Auee
  ProgressBar3.Visible := n in [3,4,5,6,7,8,9,10];
  Gauge3.Visible := n in [3,4,5,6,7,8,9,10];
  Label3.Visible := n in [3,4,5,6,7,8,9,10];
  ProgressBar4.Visible := n in [4,5,6,7,8,9,10];
  Gauge4.Visible := n in [4,5,6,7,8,9,10];
  Label4.Visible := n in [4,5,6,7,8,9,10];
  ProgressBar5.Visible := n in [5,6,7,8,9,10];
  Gauge5.Visible := n in [5,6,7,8,9,10];
  Label5.Visible := n in [5,6,7,8,9,10];
  ProgressBar6.Visible := n in [6,7,8,9,10];
  Gauge6.Visible := n in [6,7,8,9,10];
  Label6.Visible := n in [6,7,8,9,10];
  ProgressBar7.Visible := n in [7,8,9,10];
  Gauge7.Visible := n in [7,8,9,10];
  Label7.Visible := n in [7,8,9,10];
  ProgressBar8.Visible := n in [8,9,10];
  Gauge8.Visible := n in [8,9,10];
  Label8.Visible := n in [8,9,10];
  ProgressBar9.Visible := n in [9,10];
  Gauge9.Visible := n in [9,10];
  Label9.Visible := n in [9,10];
  ProgressBar10.Visible := n in [10];
  Gauge10.Visible := n in [10];
  Label10.Visible := n in [10];
end;

2й вариант:
Код:
procedure TForm1.ComboBox1Change(Sender: TObject);
var 
  i : integer;
  c : TComponent;
begin
  OnOffTimers(False);
  PBP(0);
  GP();
  Button1.Caption := 'GO!!'; 
  n := StrToInt(ComboBox1.Text);

  for i := 1 to 10 do
  begin
    c := FindComponent('Label'+IntToStr(i));
    if c <> nil then
      TLabel(c).Visible := i <= n;

    c := FindComponent('ProgressBar'+IntToStr(i));
    if c <> nil then
      TProgressBar(c).Visible := i <= n;

    c := FindComponent('Gauge'+IntToStr(i));
    if c <> nil then
      TGauge(c).Visible := i <= n;
  end;
end;
__________________
Поживу - увижу, Доживу - узнаю, Выживу - учту.
[P.S.]->Выражая благодарность за помощь - Вы получаете шанс на помощь в следующий раз
Ответить с цитированием