Вывод : Сегодня я узнал о возможностях компонентов расположенных на вкладке System.
Практическая работа №17
Тема практической работы: Основные свойства. Основные события.
Цель практической работы: Рассмотреть основные события и принцип работы.
Ход работы :
Задание №1
Рис 54 Рис 55
Рис 56 Рис 57
Листинг:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ComCtrls;
type
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
TabSheet6: TTabSheet;
TabSheet7: TTabSheet;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
BitBtn5: TBitBtn;
BitBtn6: TBitBtn;
Edit1: TEdit;
ListBox1: TListBox;
ListBox2: TListBox;
ListBox3: TListBox;
ListBox4: TListBox;
ListBox5: TListBox;
ListBox6: TListBox;
ListBox7: TListBox;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
procedure BitBtn5Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn6Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
if opendialog1.Execute then
case PageControl1.ActivePageIndex of
0:listbox1.Items.SaveToFile(opendialog1.FileName);
1:listbox2.Items.SaveToFile(opendialog1.FileName);
2:listbox3.Items.SaveToFile(opendialog1.FileName);
3:listbox4.Items.SaveToFile(opendialog1.FileName);
4:listbox5.Items.SaveToFile(opendialog1.FileName);
5:listbox6.Items.SaveToFile(opendialog1.FileName);
6:listbox7.Items.SaveToFile(opendialog1.FileName);
end;
end;
procedure TForm1.BitBtn4Click(Sender: TObject);
begin
case PageControl1.ActivePageIndex of
0:listbox1.Items.Clear;
1:listbox2.Items.Clear;
2:listbox3.Items.Clear;
3:listbox4.Items.Clear;
4:listbox5.Items.Clear;
5:listbox6.Items.Clear;
6:listbox7.Items.Clear;
end;
case PageControl1.ActivePageIndex of
0:listbox1.Items.Insert(listbox1.ItemIndex,edit1.Text);
1:listbox2.Items.Insert(listbox2.ItemIndex,edit1.Text);
2:listbox3.Items.Insert(listbox3.ItemIndex,edit1.Text);
3:listbox4.Items.Insert(listbox4.ItemIndex,edit1.Text);
4:listbox5.Items.Insert(listbox5.ItemIndex,edit1.Text);
5:listbox6.Items.Insert(listbox6.ItemIndex,edit1.Text);
6:listbox7.Items.Insert(listbox7.ItemIndex,edit1.Text);
end;
end;
procedure TForm1.BitBtn5Click(Sender: TObject);
begin
if opendialog1.Execute then
case PageControl1.ActivePageIndex of
0:listbox1.Items.LoadFromFile(opendialog1.FileName);
1:listbox2.Items.LoadFromFile(opendialog1.FileName);
2:listbox3.Items.LoadFromFile(opendialog1.FileName);
3:listbox4.Items.LoadFromFile(opendialog1.FileName);
4:listbox5.Items.LoadFromFile(opendialog1.FileName);
5:listbox6.Items.LoadFromFile(opendialog1.FileName);
6:listbox7.Items.LoadFromFile(opendialog1.FileName);
end;
end;
procedure TForm1.BitBtn6Click(Sender: TObject);
begin
case PageControl1.ActivePageIndex of
0:listbox1.Items.Clear;
1:listbox2.Items.Clear;
2:listbox3.Items.Clear;
3:listbox4.Items.Clear;
4:listbox5.Items.Clear;
5:listbox6.Items.Clear;
6:listbox7.Items.Clear;
end;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
case PageControl1.ActivePageIndex of
0:listbox1.Items.Insert(listbox1.ItemIndex,edit1.Text);
1:listbox2.Items.Insert(listbox2.ItemIndex,edit1.Text);
2:listbox3.Items.Insert(listbox3.ItemIndex,edit1.Text);
3:listbox4.Items.Insert(listbox4.ItemIndex,edit1.Text);
4:listbox5.Items.Insert(listbox5.ItemIndex,edit1.Text);
5:listbox6.Items.Insert(listbox6.ItemIndex,edit1.Text);
6:listbox7.Items.Insert(listbox7.ItemIndex,edit1.Text);
end;
edit1.Clear;
Edit1.SetFocus;
end;
end.
Достарыңызбен бөлісу: |