.


:




:

































 

 

 

 


, (Lab1).




ListBox1.

ListBox1.

1. Items : , , , , . Items ( TString) .

2. ListBox1.

3. OnClick ListBox1. OnClick .

:

Procedure TForm1.ListBox1Click(Sender:TObject);

Begin

If (Edit1.Text=' ') or (ListBox1.ItemIndex <0) Then Exit;

x:= StrToFloat(Edit1.Text);

case ListBox1.ItemIndex of

0: y:= x/400;

1: y:= x/16380;

2: y:= x/28.35;

3: y:= x/28.35*16;

4: y:= 437.5*x/28.35;

End;

Memo1.Lines.Add(FormatFloat('#####.#####=',x)+ FormatFloat('#####.##### ', y) + ListBox1.Items[ListBox1.ItemIndex]);

Edit1.Clear;

Edit1.SetFocus;

End;

ItemIndex .

Clear TEdit. SetFocus .

X Y.

4. Lab2. (F9). :

1234 = 3,085

1234 = 0,07534

1234 = 43,52734

1234 = 696,43739

1234 = 19043,20988

Anchors.

1. . , Close .

2. . , Close . Anchors. [akTop, akLeft]. [akRight, akBottom]. Anchors : akTop False; akLeft False; akRight True; akBottom True.

3. , , Anchors.

4. , , Anchors [akTop, akLeft, akRight, akBottom]. , Panel1 .

TRadioGroup.

1. TRadioGroup. ItemIndex 0. Items : , .

2. Panel2 Label2 (Caption- ) Edit2. Visible False. , , Visible True.

3. OnClick TRadioGroup.

Procedure TForm1.RadioGroup1Click(Sender:TObject);

Begin

Case RadioGroup1.ItemIndex of

0: begin

Label1.Caption:= ;

Edit2.Hide; Label2.Hide; End;

1: begin

Label1.Caption:= ;

Edit2.Show; Label2.Show; End; End; End;

Show Hide .

OnClick ListBox1:

Procedure TForm1.ListBox1Click(Sender:TObject);

Begin

If (Edit1.Text =' ') or

(ListBox1.ItemIndex <0) then Exit;

Case RadioGroup1.ItemIndex of

1: begin

if (Edit2.Text=' ') then Exit;

X_nach:=StrToFloat(Edit1.Text);

X_kon:=StrToFloat(Edit2.Text);

D:= (X_kon X_nach)/10; End;

0: begin

X_nach:=StrToFloat(Edit1.Text);

X_kon:=X_nach;

D:=1; End; End;

x:= X_nach;

while x <= X_kon do

begin

case ListBox1.ItemIndex of

0: y:= x/400;

1: y:= x/16380;

2: y:= x/28.35;

3: y:= x/28.35*16;

4: y:= 437.5*x/28.35; end;

Memo1.Lines.Add(FormatFloat('#####.#####=',x)+ FormatFloat('#####.#####',y) + ListBox1.Items[ListBox1.ItemIndex]);

x:= x + D;

end;

Edit1.Clear;

Edit1.SetFocus;

Edit2.Clear;

End;

X_nach, X_kon, D.

4. Memo1 ScrollBars ssVertical. .

5. .

TGroupBox.

Panel1 TGroupBox Caption . , .

TCheckBox.

1. State: cbUnchecked ; cbChecked ; cbGrayed . , . hecked /. TCheckBox (Caption-) TGroupBox.

2. OnClick .

Procedure TForm1.CheckBox1Click(Sender:TObject);

Begin

If CheckBox1.State = cbChecked then

Memo1.Font.Style:=[fsItalic]

Else Memo1.Font.Style:=[];

End;

3. .

TScrollBar.

1. Panel1 TScrollBar. . Position .

2. OnScroll , OnScroll Position.

Procedure Form1.ScrollBar1Scroll(Sender:TObject;ScrollCode:TScrollCode;

var ScrollPos: integer);

begin

x:= ScrollBar1.Position;

Edit1.Text:= FloatToStr(x);

RadioGroup1.ItemIndex:=0;

End;

.

3. , . OnActivate ( ).

Procedure TForm1.FormActivate(Sender:TObject);

Begin

Edit1.SetFocus; End;

Delphi Lab2.

, , :

Items
ItemIndex
Checked / TCheckBox
State : cbUnchecked ; cbChecked ; cbGrayed
Position, Min, Max ,
ScrollBars
Visible
Anchors
Clear
Show
Hide
SetFocus
OnScroll Position TScrollBar
OnActivate ( )

 

:

  1 . . = 133 1 /2 =0,1 1 . . = 1,013*105 1 *2 =9,81
  1 = 2,54 1 = 0,9144 1 = 500 1 = 1,76
  1 = 36,37 3 1 = 4,54 3 1 = 0,5683 3
  1 = 4,19 1 = 10-7 1 * = 9,81 1 * =3,6*103

 

 

3.

, . ADDITIONAL.

Run:

Run (F9) . .
Step Over (F8) . .
Trance Into (F7) . .
Run TO Cursor (F4) , Code Editor.
Program Pause .
Program Reset (Ctrl F2) .
Add Breakpoint .

 

, , Delphi. View/Debug Windows/ Breakpoints. , .

, View/Debug Windows/Watches.

Evaluate/Modify, <Ctrl-F7>. Expression , Modify New Value.

, , . : , , . . TRadioGroup. . TRadioGroup.





:


: 2017-02-25; !; : 504 |


:

:

, .
==> ...

1472 - | 1414 -


© 2015-2024 lektsii.org - -

: 0.019 .