
18.04.2012, 14:01
|
 |
Местный
|
|
Регистрация: 04.04.2008
Адрес: Минск
Сообщения: 596
Версия Delphi: 2007 & JAVA EE
Репутация: 10670
|
|
на форме 2 лист бокса и 3 конки и как-то так:
p.s. Фантазия у меня конечно больная
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
ListBox2: TListBox;
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
Button3: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var s:string;
begin
s:=ListBox1.Items[ListBox1.ItemIndex];
if ListBox2.Items.IndexOf(s)<0 then
begin
ListBox2.Items.add(s);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ListBox2.Items.Delete(ListBox2.ItemIndex);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
memo1.Clear;
if (pos('Водка',ListBox2.Items.Text)>0 )
and (pos('Пиво',ListBox2.Items.Text)>0 )
then
memo1.Lines.Add('ЕРЖЖЖЖЬЬЬЬ');
if (pos('Водка',ListBox2.Items.Text)>0 )
and (pos('Шампанское',ListBox2.Items.Text)>0 )
then
memo1.Lines.Add('СЕверноЕ сияНие!!');
if memo1.Lines.Text='' then memo1.Lines.Add('ХЗ что это такое :)');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ListBox1.items.add('Пиво');
ListBox1.items.add('Водка');
ListBox1.items.add('Вино');
ListBox1.items.add('Коньяк');
ListBox1.items.add('Мартини');
ListBox1.items.add('Виски');
ListBox1.items.add('Шампанское');
memo1.Clear;
end;
end.
__________________
Последний раз редактировалось Admin, Сегодня в 10:32.
|