Принципы визуального программирования: Методические указания к лабораторной работе

  • Published on
    08-Dec-2016

  • View
    214

  • Download
    2

Embed Size (px)

Transcript

  • _______________________________________________________ ________________ .. __ ______2002 .

    130 550200

    - 2002

  • 681.3 . 130 550200 . . .. ..., .. ___ ___________ 2002 . . ..

  • 1 .................................................................. 4 1.1 ............................. 4 1.2 ................................... 5 1.3 .............. 5 1.4 ............................................... 7 1.5 ........................................................ 7 1.6 ................................................. 7 1.7 .................................... 8 1.8 ................................ 8 1.9 .................... 9 2 ........................................ 10 2.1 ............. 11 2.2 ................................................... 11 2.2.1 - ......................... 11 2.2.2 - ........................... 12 2.2.3 ................... 12 2.2.4 ............................................ 14 2.2.5 ............................................. 15 2.2.6 ............................................. 15 3 ......................................................................15 3.1 ........................... 15 3.2 ............................................................... 16 3.3 ................................ 16 3.4 ......................................................... 17 4 ............................................................................................ 18 4.1 , ................................ 18 4.2 ................................................................. 19 4.3 ........................................................... 19 5 ............................................................... 19 5.1 ............................................................... 19 5.2 ........................... 20 5.2.1 .................................................... 20 5.2.2 .................................................. 21 5.2.3 .............21 5.3 ....................... 23 5.3.1 ................................................... 24 5.3.2 ................................................. 24 5.3.3 ............ 25 5.4 ............................................. 27 5.4.1 .................................................... 27 5.4.2 .................................................. 27 5.4.3 ............. 28 6 ....................................................................... 30 7 ................................................................... 30 8 ......................................................................................... 31

  • 4

    . , Delphi. : 1) , . 2) , . 3) . 4) . 5) , . 6) . 1 - , Delphi. , , , . , - - . - , , , . , Delphi , . , , . Delphi . ( ) , . , Windows, , , , . 1.1 Delphi . ( , ) . Delphi , . , . ( ), , . ( , ). , . 1.2

  • 5

    - . : 1. , , . , . , Delphi . . 2. . 3. . 4. , . Delphi , . , . , , , , . : 1. Delphi, . 2. / / . 3. Standard . 4. (Button), , . 5. . 6. , . Delphi , . , . 7. Delphi Button1, . 1. 1.3 , , . : 1. , . 2. , . Delphi (. . ) . 3. Ctrl - C, (Clipboard). 4. Ctrl - V, . (Caption) , . 5. . 6. 2 5, . , . :

  • 6

    . 1. .

    .2. - . 1. , . 2. Ctrl - C, . 3. Ctrl - V, . (Caption) Button1, (Name) Button2 (. ). 4. . 5. 2 4, . .2 , (Caption). 1.4

  • 7

    Delphi , , . , : 1. , . 2. , . Delphi . 3. Shift , . Delphi . , , Shift. Shift . 1.5 Delphi , , . , , Delete. , ( ) Delete. Ctrl - Z, , . 1.6 Delphi , . , : 1. , . 2. , . . 3. ( ), . 4. , . , : 1. , . 2. , . . 3. ( ), . 4. , . 1.7

  • 8

    Delphi . , : 1. , . 2. . . : , . 3. , . 4. , . . 3 .

    .3. - , . 1.8 Delphi . , . / , . , . . . :

    - , -

    , -

    , -

    .

    .4 .

  • 9

    .4. . 1.9 Delphi . , . / , . . , . , . : - , - ( ), - , - ( ), - ( ), - ( ), - , - . .5 ( ).

  • 10

    .5. . 2

    - , . , - , , . , . , ( ), . - . , , . , Delphi , (public), (protected) (private) . , , , . , , . . , , , , . , . , , , . Delphi , . TForm Delphi. , Delphi TForm1, TForm. Delphi ,

  • 11

    Delphi, TForm1 - . , TForm1 TForm. Delphi BUTTON TForm1 CloseBtn CloseBtnClick. TForm 299 , . 2.1 , . . , . Delphi . , . , : 1. , . . 2. . , . , . 3. , . Delphi . 4. , . , , Close. 2.2 , , . ( , ) . , , , . . . 2.2.1 - : 1. (Button) , Standard. 2. . 3. , . 4. Caption, Close. 5. Name, CloseBtn.

  • 12

    6. , . 7. OnClick. Delphi Click, Close. 2.2.2 - (Label) : 1. Label , Standard . 2. , . 3. , . 4. Caption, [x,y]. 5. Name, MouseLbl. 2.2.3 . : 1. , . 2. OnClick. Delphi Click, : MessageDlg(You clicked on the form, mtInformation, [mbOK],0); , OnMouseMove. Delphi , begin: var s, bigStr : string; begin: Str(X,s); bigStr := [ + s + ,; Str (Y,s); bigStr := bigStr + s + ]; MouseLbl.Caption := bigStr; UFORM.PAS, - FORM.DPR. 1 FORM.DPR. 2 UFORM.PAS. , . 1. FORM.DPR. _________________________________________________________________________ 1: program Form;

  • 13

    2: 3: uses 4: Forms, 5: Uform in 'UFORM.PAS' {Form1}; 6: 7: {$R *.RES} 8: 9: begin 10 Application.Initialize; 11: Application.CreateForm(TForm1, Form1); 12: Application.Run; 13: end. _________________________________________________________________________ 2. UFORM.PAS. _________________________________________________________________________ 1: unit Uform; 2: 3: interface 4: 5: uses 6: SysUtils, Windows, Variants, Messages, Classes, Graphics, Controls, 7: Forms, Dialogs, StdCtrls; 8: 9: type 10: TForm1 = class(TForm) 11: CloseBtn: TButton; 12: MouseLbl: TLabel; 13: procedure CloseBtnClick(Sender: TObject); 14: procedure FormClick(Sender: TObject); 15: procedure FormMouseMove(Sender: TObject; 16: Shift: TShiftState; 17: X,Y: Integer); 18: private 19: { Private declarations } 20: public 21: { Public declarations } 22: end; 23: 24: var 25: Form1: TForm1; 26: 27: implementation 28: 29: {$R *.DFM} 30: 31: procedure TForm1.CloseBtnClick(Sender: TObject);

  • 14

    32: begin 33: Close; 34: end; 35: 36: procedure TForm1.FormClick(Sender: TObject); 37: begin 38: MessageDlg('You clicked on the form', 39: mtInformation,[mbOK],0); 40: end; 41: 42: 43: procedure TForm1.FormMouseMove(Sender: Tobject; 44: Shift: TShiftState; 45: X,Y: Integer); 46: 47: var s, bigStr : String; 48: 49: begin 50: Str(X,s); 51: bigStr:='['+s+','; 52: Str(Y,s); 53: bigStr:=bigStr+s+']'; 54: MouseLbl.Caption:=bigStr; 55: end; 56: 57: end. _________________________________________________________________________ 13 17 . 13 , . 14 , . 15 17 , . 31 34 CloseBtnClick. 36 40 FormClick. 43 55 FormMouseMove. , TForm1. 2.2.4 , , . 13 17 2 . - . Delphi 13 17. , . . 2.2.5

  • 15

    , . . , Delphi, . , CloseBtnClick ( 13 2) , Sender. TObject. (.. , , ) Sender , . , Sender, , . 15 17 2 FormMouseMove. Sender, Shift, X Y. Shift . , , Ctrl, Shift Alt. X Y . 2.2.6 Delphi - . , . 33 Close, TForm1.CloseBtnClick. , , Sender. 38 39 MessageDlg, TForm1.FormClick. Sender. 47 50 54 TForm1.FormMouseMove. 47 S bigStr, . 50 54 , . , , X Y. , ( Caption) - . 3 . - , . - , . 3.1 Delphi . , , . , . , , . , , Delphi .

  • 16

    , , Boolean Visible, . , . . 3.2 - , , . , Left Top , . - Caption Name, . . , Enter. . 6 Delphi, Caption. .6. Delphi, Caption. 3.3 . - Boolean. , True, False. Boolean, . . Boolean : False True. , , . . . 7 Delphi, Visible Boolean. 3.4 . . , . Delphi

  • 17

    . , . , Font Style . : . . , [ ]. - Boolean. .8 Style

    .7. Delphi, Visible Boolean.

    .8. Style . , . . , , Font, . , , . .9 .

  • 18

    .9. Font. 4 DOS - . , Windows ( Delphi) . Windows , . Windows , , , , . Windows . Delphi - . 4.1 , , . , . Delphi , . - . , . . , , , . , . , .

  • 19

    4.2 , , . Delphi : . Delphi . . Enter. Delphi : . . begin - end . BUTTON FORM . 4.3 . 2, . TForm1.CloseBtnClick Close 33. TForm1.FormClick MessageDlg 38 39. TForm1.FormMouseMove ( 50 54) . 5 Delphi , . , . Delphi , . 5.1 - , . / . : . (Modal) , . , , , . (Modeless), , . , . , . , .

  • 20

    5.2 Delphi . . , FrmDlg1, . FrmDlg1 : , . c Close. , , Good Bye ! . , , , . , . 5.2.1 .10, . , : .10. FrmDlg1. 1. Standard . 2. . 3. Caption Close. 4. Name CloseBtn. 5. Caption Main Form. 6. UFORM11.PAS. 5.2.2 , / / . , .11. , : 1. . 2. .

  • 21

    3. Caption .

    .11. FrmDlg1. 4. Name OKBtn. 5. (Label) . 6. Caption Good Bye ! 7. Name ByeLbl. 8. Font. 9. Size 24. 10. , . 11. Caption Modal Dialog Form. 12. Color clYellow, . 13. BorderStyle bsDialog. 14. UFORM12.PAS. 15. FRMDLG1.DPR. 5.2.3 . . , - . , OnClick. 3 UFORM11.PAS. . uses, Uform12. , , Form2. , Uform12, TForm2 . 4 UFORM12.PAS. 29 , TForm2.OKBtnClick. 3. UFORM11.PAS. ______________________________________________________________________ 1: unit Uform11; 2: 3: interface 4:

  • 22

    5: uses 6: SysUtils, Windows, Variants, Messages, Classes, Graphics, Controls, 7: Forms, Dialogs, StdCtrls, 8: {Manualy insert unit name} 9: Uform12; 10: 11: type 12: TForm1 = class(TForm) 13: CloseBtn: TButton; 14: procedure CloseBtnClick(Sender: TObject); 15: private 16: { Private declarations } 17: public 18: { Public declarations } 19: end; 20: 21: var 22: Form1: TForm1; 23: 24: implementation 25: 26: {$R *.DFM} 27: 28: procedure TForm1.CloseBtnClick(Sender: TObject); 29: begin 30: Form2.ShowModal; 31: Close; 32: end; 33: 34: end. ______________________________________________________________________ 4. UFORM12.PAS. ____________________________________________________________________ 1: unit Uform12; 2: 3: interface 4: 5: uses 6: SysUtils, Windows, Variants, Messages, Classes, Graphics, Controls, 7: Forms, Dialogs, StdCtrls; 8: 9: type 10: TForm2 = class(TForm) 11: OKBtn: TButton; 12: ByeLbl: TLabel; 13: procedure OKBtnClick(Sender: TObject); 14: private 15: { Private declarations } 16: public

  • 23

    17: { Public declarations } 18: end; 19: 20: var 21: Form2: TForm2; 22: 23: implementation 24: 25: {$R *.DFM} 26: 27: procedure TForm2.OKBtnClick(Sender: TObject); 28: begin 29: Close; 30: end; 31: 32: end. 3 Uform11, . , TForm1.CloseBtnClick . 30 - ShowModal Form2 ( ). - ShowModal, . , BorderStyle bsDialog . lose 31 , . . 29 4 lose, . 5.3 Delphi . . FrmDlg2 : , . Clos Show Form. , , Good Bye ! . , . Close , ( ) . . 5.3.1 . 12, : . :

  • 24

    . 12. FrmDlg2. 1. Standard . 2. - . 3. Caption Close. 4. Name CloseBtn. 5. . 6. Caption Show Form. 7. Name ShowFormBtn. 8. Caption Main Form. 9. UFORM21.PAS. 5.3.2. , / / . . , : 1. . 2. . 3. Caption . 4. Name OKBtn. 5. . 6. Caption Good Bye ! 7. Name ByeLbl. 8. Font. 9. Size 24. 10. , . 11. Caption Modeless Dialog Form. 12. Color clYellow, . 13. Border Style bsDialog. 14. UFORM22.PAS. 15. FORMDLG2.DPR. 5.3.3....

Recommended

View more >