全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:2507
推到 Plurk!
推到 Facebook!

ComboBox的用法

答題得分者是:Zard
小丫123
初階會員


發表:85
回覆:62
積分:29
註冊:2004-08-31

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-01-02 11:16:23 IP:218.65.xxx.xxx 未訂閱
在ComboBox的Items中定义了几个数如10次,100次,反复无穷次。运行: 当选择10次是,希望得到RepeatCount:=10 100次RepeatCount:=10 反复无穷次时 RepeatCount:=indefinite 恳求前辈指点
deity
尊榮會員


發表:90
回覆:876
積分:678
註冊:2003-05-09

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-01-02 12:01:36 IP:219.129.xxx.xxx 未訂閱
引言: 在ComboBox的Items中定义了几个数如10次,100次,反复无穷次。运行: 当选择10次是,希望得到RepeatCount:=10 100次RepeatCount:=10 反复无穷次时 RepeatCount:=indefinite 恳求前辈指点
小丫123您好: RepeatCount:string; RepeatCount:=Combobox1.Items[Combobox1.ItemIndex];

~~~为什么经过多年以后,得失的过程如此冷漠~~~

發表人 - DEITY 於 2005/01/02 12:07:21
Zard
尊榮會員


發表:24
回覆:396
積分:539
註冊:2003-11-26

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-01-02 12:14:02 IP:61.64.xxx.xxx 未訂閱
引言: 在ComboBox的Items中定义了几个数如10次,100次,反复无穷次。运行: 当选择10次是,希望得到RepeatCount:=10 100次RepeatCount:=10 反复无穷次时 RepeatCount:=indefinite 恳求前辈指点
unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;    type
  TForm1 = class(TForm)
    ComboBox1: TComboBox;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;    var
  Form1: TForm1;    implementation    {$R *.DFM}    procedure TForm1.FormCreate(Sender: TObject);
begin
  ComboBox1.Items.Clear;
  ComboBox1.Items.Add('10次');
  ComboBox1.Items.Add('100次');
  ComboBox1.Items.Add('無限次');
  ComboBox1.ItemIndex := 0;
end;    procedure TForm1.Button1Click(Sender: TObject);
var
  iRepeatCount: Integer;    begin
  case ComboBox1.ItemsIndex of
    0: // 使用者選10次
    begin
      iRepeatCount := 10;
    end;        1: // 使用者選100次
    begin
      iRepeatCount := 100;
    end;        2: // 使用者選無限次
    begin
      // 我用-1代表無限次
      iRepeatCount := -1;
    end;
  end;      // iRepeatCount = 0 時才會跳出迴圈, 所以iRepeatCount = -1就是無限迴圈了
  while(iRepeatCount = 0) do
  begin
    // 做要在loop中做的事.....        Dec(iRepeatCount);
  end;
end;    end.
Zard
尊榮會員


發表:24
回覆:396
積分:539
註冊:2003-11-26

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-01-02 12:24:01 IP:61.64.xxx.xxx 未訂閱
引言: 在ComboBox的Items中定义了几个数如10次,100次,反复无穷次。运行: 当选择10次是,希望得到RepeatCount:=10 100次RepeatCount:=10 反复无穷次时 RepeatCount:=indefinite 恳求前辈指点
打錯重貼..
unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;    type
  TForm1 = class(TForm)
    ComboBox1: TComboBox;
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;    var
  Form1: TForm1;    implementation    {$R *.DFM}    procedure TForm1.FormCreate(Sender: TObject);
begin
  ComboBox1.Items.Clear;
  ComboBox1.Items.Add('10次');
  ComboBox1.Items.Add('100次');
  ComboBox1.Items.Add('無限次');
  ComboBox1.ItemIndex := 0;
end;    procedure TForm1.Button1Click(Sender: TObject);
var
  iRepeatCount: Integer;    begin
  case ComboBox1.ItemIndex of
    0: // 使用者選10次
    begin
      iRepeatCount := 10;
    end;        1: // 使用者選100次
    begin
      iRepeatCount := 100;
    end;        2: // 使用者選無限次
    begin
      // 我用-1代表無限次
      iRepeatCount := -1;
    end;
  end;      // iRepeatCount = 0 時才會跳出迴圈, 所以iRepeatCount = -1就是無限迴圈了
  while(iRepeatCount = 0) do
  begin
    // 做要在loop中做的事.....        Dec(iRepeatCount);
  end;
end;    end.
系統時間:2024-07-02 20:55:10
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!