unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ComboBox1: TComboBox;
ComboBox2: TComboBox;
ComboBox3: TComboBox;
ComboBox4: TComboBox;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Button1: TButton;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
label5.Caption := '';
combobox1.ItemIndex := -1;
combobox2.ItemIndex := -1;
combobox3.ItemIndex := -1;
combobox4.ItemIndex := -1;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i: integer;
p: string;
begin
p := '你选的机器配置:' + #13;
i := combobox1.ItemIndex;
p := p + '机型:' +combobox1.Items[i] + #13;
i := combobox2.ItemIndex;
p := p + 'CPU:' + combobox2.Items[i] + #13;
i := combobox3.ItemIndex;
p := p + '内存:' +combobox3.Items[i] + #13;
i := combobox4.ItemIndex;
p := p + '硬盘:' + combobox4.Items[i];
label5.Caption := p;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
combobox1.Items.Add('IBM');
combobox1.Items.Add('AST');
combobox1.Items.Add('Compaq');
combobox1.Items.Add('长城');
combobox1.Items.Add('联想');
combobox1.Items.Add('清华同方');
combobox2.Items.Add('586/133');
combobox2.Items.Add('586/200');
combobox2.Items.Add('PII/233');
combobox2.Items.Add('PII/400');
combobox2.Items.Add('PⅢ/450');
combobox2.Items.Add('PⅢ/600');
combobox3.Items.Add('16MB');
combobox3.Items.Add('32MB');
combobox3.Items.Add('64MB');
combobox3.Items.Add('128MB');
combobox3.Items.Add('256MB');
combobox4.Items.Add('2.5G');
combobox4.Items.Add('3.2G');
combobox4.Items.Add('4.3G');
combobox4.Items.Add('9G');
combobox4.Items.Add('15G');
end;
end.
