.


:




:

































 

 

 

 


Var Num1, Num2 CountR implementation.




10

Ż

, . . , - " ", , Enter. " " .  

, : , , - . ,
.

: ListBox Items ItemIndex, Label.

Delphi (IDE Integrated Development Environment), , 32 Windows 95, 98, 2000, NT.

Delphi ,
.. , .

, .

Delphi , Visual Basic C++. .

Delphi Object Pascal, , Turbo Pascal. , , , , .

:

- , , , ;

- , , , , , .

, 8

1. .
2. . , .

Label :

Object Inspector / /
Label1 Properties AutoSize ( Caption) False
WordWrap ( ) True
Height Width
Alignment ( ) taCenter

3. :

Object Inspector / /
BitBtn1   Properties   Caption &
Kind bkCancel
Events BitBtn1Click Close;

4. , , Unit8.pas Pr8.dpr.

5. , .
6. ListBox1, Object Inspector Items, . , :



Fiz1.txt. Save. OK.
7. Listbox2 , :




Fiz2.txt.
8. :

Object Inspector / /
ListBox1 Events OnKeyPress If key=#13 then Num1:=ListBox1.ItemIndex;
ListBox2 Events OnKeyPress If key=#13 then begin case ListBox2.ItemIndex of 0: Num2:= 2; 1: Num2:= 1; 2: Num2:= 3; 3: Num2:= 0; end; if Num1=Num2 then begin Label4.Caption:=''; CountR:=CountR+1 End Else Label4.Caption:= ''; If CountR=5 then ShowMessage( ! );

Var Num1, Num2 CountR implementation.

, 8

 
  ListBox1 ListBox2 Enter. Object Inspector Enabled ListBox2 False, KeyPressed, ListBox1, : ListBox2.Enabled:= True; ListBox1.Enabled:= False; Form1.ActiveControl:= ListBox2;
  , . KeyPressed, ListBox2, , , : ListBox1.Items.Delete(Num1); ListBox1.Items.Insert(Num1, );
  10. .  

9. , .

  u , 8 nit Unit7; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons; type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; ListBox1: TListBox; ListBox2: TListBox; Label3: TLabel; BitBtn1: TBitBtn; Label4: TLabel; BitBtn2: TBitBtn; procedure BitBtn1Click(Sender: TObject); procedure ListBox1KeyPress(Sender: TObject; var Key: Char); procedure ListBox2KeyPress(Sender: TObject; var Key: Char); procedure BitBtn2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; c,r,num1,num2:integer; implementation {$R *.DFM} procedure TForm1.BitBtn1Click(Sender: TObject); begin Close end; procedure TForm1.ListBox1KeyPress(Sender: TObject; var Key: Char); begin If (Key=#13) and (Form1.ListBox1.Items.Strings[Form1.1ListBox1.ItemIndex]<>'') Then begin num1:=form1.listbox1.itemindex; form1.ListBox1.Enabled:=False; form1.ListBox2.Enabled:=True; form1.ActiveControl:=Listbox2 end end; procedure TForm1.ListBox2KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin case form1.ListBox2.ItemIndex of 0:num2:=2; 1:num2:=4; 2:num2:=7; 3:num2:=0; 4:num2:=3; 5:num2:=1; 6:num2:=6; 7:num2:=8; 8:num2:=5; 9:num2:=9; end; if num1=num2 then begin form1.Label4.Caption:='!'; r:=r+1 end else form1.Label4.Caption:='!'; c:=c+1; form1.ListBox1.Items.Delete(num1); form1.ListBox1.Items.Insert(num1,''); if c=10 then showmessage(' . :'+ inttostr (r div 2 + ord(r div 2<1))+' ( : '+inttostr(r)+')'); form1.ListBox1.Enabled:=0=0; form1.ListBox2.Enabled:=0=0; form1.ActiveControl:=listbox1 end end; procedure TForm1.BitBtn2Click(Sender: TObject); begin c:=0; r:=0; num1:= -1; num2:= -1; form1.ListBox1.Items.LoadFromFile('fiz1.txt'); end; end.  
'fiz1.txt'   'fiz2.txt'
 
         

 


Ż

, .

16. . "", "", "", "".

 

: RadioGroup Standard, ShowMessage.

, 9

1. .
2.

 

3. :

Object Inspector / /
Label1 Properties Caption
Label2 Properties Caption
Label3 Properties Caption
Label4 Properties Caption
Label5 Properties Caption
RadioGroup1 Properties Caption
Columns  
Items String List Editor, Items. 5 : -1 -20 -60 t1.txt.
RadioGroup2 Properties Caption
Columns  
Items 4 : t2.txt.
RadioGroup3 Properties Caption
Columns  
Items 4 : 1024 512 1.5 2 t3.txt.
RadioGroup4 Properties Caption
Columns  
Items 4 : t4.txt.
RadioGroup5 Properties Caption
Columns  
Items 3 : t5.txt.

4. , , Unit8.pas Pr8.dpr.
5. :

Object Inspector / /
RadioGroup1 Events OnClick sum:=0; If RadioGroup1.ItemIndex=3 Then sum:=Sum+1; : 0. , 3.

sum Var implementation.
6. RadioGroup2.OnClick, RadioGroup3.OnClick, RadioGroup4.OnClick, RadioGroup5.OnClick , , sum, .
7. .

Object Inspector / /
RadioGroup5 Events OnClick Case sum of 0..2: Panel1.Caption:='!'; 3: Panel1.Caption:='!'; 4: Panel1.Caption:='!'; 5: Panel1.Caption:='!'; end;

8. , RadioGroup5.OnClick :

ShowMessage(' ');

9. , .

, 9

 
  . ( ) IntToStr(sum).
  , RadioGroup1, RadioGroup2 .. , . ,  
  .  
  . Case Font.Color . : Panel1.Font.Color:=clRed;
  , , .  

, 9

unit unit8; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, ExtCtrls; type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; RadioGroup1: TRadioGroup; RadioGroup2: TRadioGroup; RadioGroup3: TRadioGroup; RadioGroup4: TRadioGroup; RadioGroup5: TRadioGroup; Label6: TLabel; Panel1: TPanel; BitBtn1: TBitBtn; Button1: TButton; BitBtn2: TBitBtn; procedure Button1Click(Sender: TObject); procedure BitBtn2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; type T1 = array[0..4, 0..4] of byte; const otv:T1=((0,0,0,1,0),(0,1,0,0,0),(0,1,0,0,0),(0,1,0,0,0),(1,0,0,0,0)); var Form1: TForm1; sum:integer; implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); begin sum:=otv[0,RadioGroup1.ItemIndex]+otv[1,RadioGroup2.ItemIndex]+ otv[2,RadioGroup3.ItemIndex]+otv[3,RadioGroup4.ItemIndex]+ otv[4,RadioGroup5.ItemIndex]; case sum of 0..2:begin Panel1.Font.Color:=$000000; Panel1.Caption:=IntToStr(sum)+' .!'; end; 3: begin Panel1.Font.Color:=$0000FF; Panel1.Caption:=IntToStr(sum)+' .!'; end; 4: begin Panel1.Font.Color:=$00FF00; Panel1.Caption:=IntToStr(sum)+' .!'; end; 5:begin Panel1.Font.Color:=$FF0000; Panel1.Caption:=IntToStr(sum)+' .!'; end; end; end; procedure TForm1.BitBtn2Click(Sender: TObject); begin RadioGroup1.ItemIndex:= -1; RadioGroup2.ItemIndex:= -1; RadioGroup3.ItemIndex:= -1; RadioGroup4.ItemIndex:= -1; RadioGroup5.ItemIndex:= -1; Panel1.Caption:=''; end; end.

 


Ȼ

21
, : , , .
, ( ), .

 

: , Tabbed pages New Items Forms, MainMenu ( ), Memo ( ), Image ( ) Additional, PageControl ( ).

, 10

2.

2.1. .

21
2.2. .
2.3. Image ( ), Additional.
Image, Object Inspector Picture, . Picture Editor Load, . , ( OK), .

2.4. , .

2.5. . , .

2.6. , , F_Titul.pas Pr_Test.dpr.





:


: 2016-12-18; !; : 822 |


:

:

, .
==> ...

1513 - | 1282 -


© 2015-2024 lektsii.org - -

: 0.032 .