- •Тәжірибелік жұмыс №1
- •Тәжірибелік жұмыс №2
- •Тәжірибелік жұмыс №3
- •Тәжірибелік жұмыс №4
- •Тәжірибелік жұмыс №5
- •Тәжірибелік жұмыс №6
- •Тәжірибелік жұмыс №7
- •Тәжірибелік жұмыс №8
- •Тәжірибелік жұмыс №10
- •Тәжірбиелік жұмыс №9
- •Тәжірибелік жұмыс №11
- •Тәжірибелік жұмыс №12
- •Тәжірибелік жұмыс №13
- •Тәжірибелік жұмыс №14
- •Тәжірибелік жұмыс №15
- •Тәжірибелік жұмыс №16
- •Тәжірибелік жұмыс №17
- •Тәжірибелік жұмыс №18
- •Тәжірибелік жұмыс №19
- •Тәжірибелік жұмыс №20
- •Тәжірибелік жұмыс №22
- •Тәжірибелік жұмыс №23
- •Тәжірбиелік жұмыс №26
- •Тәжірибелік жұмыс №27
- •Тәжірибелік жұмыс №28
- •Тәжірибелік жұмыс №29
Тәжірибелік жұмыс №7
Тапсырма: Справочник бағдарламасын құру.
Орындалуы: Пуск > Все программы> Borland Delphi 7 ортасын ашып жаңа формаға BitBtn(1), Label(4), ListBox(1) компоненттерін алып, форманы келесі түрге келтіреміз (11-сурет). Алынған компоненттерге келесі қасиеттерді орнатамыз(Кесте 7).
Компонент |
Терезе бөлігінен Object Inspector |
Қасиеті |
Сипаттама |
|||
Label1 |
Properties |
Caption |
'Справочник записи цвета в формате RGB' |
|||
Label2 |
Properties |
Caption |
'Цвет в формате RGB' |
|||
Label3 |
Properties |
Caption |
' ' |
|||
Label4 |
Properties |
Caption |
' ' |
|||
BitBtn1 |
Properties |
Kind |
&close |
|||
Listbox1 |
Properties |
Items |
black white red green azure blue puple yellow brown lime violet gray
|
|||
13-сурет. Форма түрі.
ListBox1 компонентінің OnClick қасиетіне келесі кодты жазамыз:
procedure TForm1.ListBox1Click(Sender: TObject);
begin
if listbox1.ItemIndex=0 then
label4.Caption:='черный';
label4.Font.Color:=000000;
if listbox1.ItemIndex=1 then begin
label4.Caption:='белый';
label4.Font.Color:=clwhite;
end;
if listbox1.ItemIndex=2 then begin
label4.caption:='красный';
label4.font.color:=clred;
end;
if listbox1.itemindex=3 then begin
label4.Caption:='зеленый';
label4.font.color:=clgreen;
end;
if listbox1.itemindex=4 then begin
label4.caption:='голубой';
label4.font.color:=claqua;
end;
if listbox1.itemindex=5 then begin
label4.caption:='синий';
label4.font.color:=clblue;
end;
if listbox1.itemindex=6 then begin
label4.Caption:='пурпурный';
label4.font.color:=clpurple;
end;
if listbox1.itemindex=7 then begin
label4.caption:='желтый';
label4.font.color:=clyellow;
end;
if listbox1.itemindex=8 then begin
label4.caption:='коричневый';
label4.font.color:=clmaroon;
end;
if listbox1.itemindex=9 then begin
label4.caption:='лаймовый';
label4.color:=cllime;
end;
if listbox1.itemindex=10 then begin
label4.caption:='фиолетовый';
label4.font.color:=clfuchsia;
end;
if listbox1.itemindex=11 then begin
label4.caption:='серый';
label4.font.color:=clgray;
end;
end;
end.
14-сурет.Нәтиже.
Тәжірибелік жұмыс №8
Тапсырма: Конвейер бағдарламасын кұру.
Орындалуы: Пуск > Все программы> Borland Delphi 7 ортасын ашып жаңа формаға Edit(4), Label(6), ListBox(1) компоненттерін алып, форманы келесі түрге келтіреміз (13-сурет). Алынған компоненттерге келесі қасиеттерді орнатамыз(Кесте 8).
Компонент |
Object Inspector |
Қасиеті |
Сипаттама |
Label1 |
Properties |
Caption |
' ' |
Label2 |
Properties |
Caption |
' ' |
Label3 |
Properties |
Caption |
' ' |
Label4 |
Properties |
Caption |
' ' |
Label5 |
Properties |
Caption |
'грамм' |
Label6 |
Properties |
Caption |
'кг' |
Label7 |
Properties |
Caption |
'центнер' |
Label8 |
Properties |
Caption |
'тонна' |
Listbox1 |
Properties |
Items |
грамм кг центнер тонна |
15-сурет.Форма түрі.
var a,b,c,d,t1,t2,t3,t4:real;
ListBox1компонентінің OnClick қасиетіне келесі кодты жазамыз:
procedure TForm1.ListBox1Click(Sender: TObject);
begin
a:=strtofloat(edit1.text);
b:=strtofloat(edit2.text);
c:=strtofloat(edit3.text);
d:=strtofloat(edit4.text);
if listbox1.itemindex=0 then begin
t1:=a*1;
t2:=b*1000;
t3:=c*100000;
t4:=d*1000000;
end;
if listbox1.itemindex=1 then begin
t1:=a/1000;
t2:=b*1;
t3:=c*100;
t4:=d*1000;
end;
if listbox1.itemindex=2 then begin
t1:=a/100000;
t2:=b/100;
t3:=c*1;
t4:=d*10;
end;
if listbox1.itemindex=3 then begin
t1:=a/1000000;
t2:=b/1000;
t3:=c/10;
t4:=d*1
end;
label1.caption:=floattostr(t1);
label2.caption:=floattostr(t2);
label3.caption:=floattostr(t3);
label4.caption:=floattostr(t4);
end;
end.
16-сурет. Нәтиже.
