.


:




:

































 

 

 

 


with Image1.Canvas do begin




Pen.Color:=clBlack; //

Brush.Color:=clGreen; //

xmax:=Image1.Width; // x

ymax:=Image1.Height; // y

{ }

yo:=ymax div 2;

MoveTo(0,yo); LineTo(xmax,yo);

MoveTo(0,0); LineTo(0,ymax);

Pen.Color:=clRed; //

Pen.Width:=2; //

hx:=(xomax-xomin)/xmax; // -

hy:=(yomax-yomin)/ymax; // ( ) X Y

{ }

h:=(xk-xn)/(m-1);

x:=xn;

y:=f(x); //

MoveTo(Round(x/hx),Round(yo-y/hy));

for i:=1 to m do begin

x:=x+h;

y:=f(x);

LineTo(Round(x/hx),Round(yo-y/hy));

end;

end;

end;

 

 

procedure TForm1.Button2Click(Sender: TObject);

Begin

ClipBoard.Assign(Image1.Picture); //

end;

 

procedure TForm1.Button3Click(Sender: TObject);

Begin

xn:=StrToFloat(Edit1.Text);

xk:=StrToFloat(Edit2.Text);

m:=StrToInt(Edit3.Text);

xomin:=StrToFloat(Edit4.Text);

xomax:=StrToFloat(Edit5.Text);

yomin:=StrToFloat(Edit6.Text);

yomax:=StrToFloat(Edit7.Text);

{ }

With Chart1 do begin

LeftAxis.Automatic:=False;

LeftAxis.Minimum:=yomin;

LeftAxis.Maximum:=yomax;

BottomAxis.Automatic:=False;

BottomAxis.Minimum:=xomin;

BottomAxis.Maximum:=xomax;

SeriesList[0].Clear;

h:=(xk-xn)/(m-1); x:=xn;

for i:=1 to m do begin

y:=f(x);

SeriesList[0].AddXY(x,y);

x:=x+h;

end;

end;

end;

procedure TForm1.Button4Click(Sender: TObject);

Begin

Chart1.CopyToClipboardMetafile(True); //

end;

End.

9.4.

x 3. x h. TEdit. .

. , TCanvas . TImage, 2/3 . . .

1. , b, . , .

2. , b, , d. , .

3. R1 R2 (x1, y1), (2, 2) .

4. R (x0, 0) , (x1, y1) (2, 2) (, , ).

5. , R (0, 0).

6. R1 R2 (1, 1) (2, 2) .

7. , (1, 1) ++=0.

8. 1(1, 1), 2(2, 2) +By+=0. 0(0, 0), .

9. (1, 1), (2, 2), (3, 3), , . .

10. (1, 1), (2, 2), (3, 3), (4, 4). , .

11. (1, 1), (2, 2), (3, 3), (4, 4). , : ) ; ) ; ) .

12. (1, 1) (2, 2). . .

13. (1, 1) (2, 2) , , (3, 3). , .

14. (1, 1), (x2, y2), (3, 3) . .

15. (1, 1), (x2, y2), (3, 3) . .


 

10.

: - (). .

10.1.

, Delphi , Class. Record, Class (), (). , .

Delphi , ( ^ ).

10.2.

, . B A, -, B -. . Delphi TObject.

. - - .

10.3. ,

, . (.. ) . Delphi Create, TObject. :

< --- >:= <- >. Create;

, , TObject Destroy Free. Free , , Destroy , , .. :

<--- >. Free;

onstructor Destructor, Create Free .

. , .. , .. . , , , as .

10.4. ,

Var . , . , , - Self, , .

-: , , , .

, ( ).

( ). , .

. override. (dynamic) (virtual). Inherited ().

dynamic virtual, DMT VMT. . VMT , . DMT VMT. , .

DMT VMT , DMT , dynamic , VMT : , .

(abstract), .. , . , , . .

10.5.

, , . , . property read write;.

, .

, , :

Property x:TPole read GetPole write SetPole;

Getpole , SetPole . , write.

10.6.

: , Show Hide . -, , , (). .

. 10.1.

. 10.1.

10.1, 10.2.

10.1.

Unit Unit2;

Interface

uses Graphics;

var ColrBack:Tolor;

Type

Tviz=class(Tobject) //

ColrLine: Tcolor;

Canvas: Tcanvas;

x, y, r: word;

Procedure Ris;virtual;abstract; //

Procedure Draw(bl:boolean);

procedure Show; //

procedure Hide; //

procedure MovTo(dx,dy,dr:integer); //

end;

TKrug=class(Tviz) //

x1,y1,x2,y2:word;

Constructor Create(x0,y0,r0:word; colrLine0:Tcolor;canvas0:Tcanvas);

Procedure Ris; override;

end;

TKvad=class(Tkrug) //

Procedure Ris; override;

end;

TKrPr=class(Tkrug) //

dy1:word;

Constructor Create(x0,y0,r0,dy0:word; colrLine0:Tcolor;canvas0:Tcanvas);

Procedure Ris; override;

end;

Implementation //

Procedure Tviz.Draw; //

begin // Ris

with Canvas do begin // , .

if bl then begin //

pen.color:=colrLine; brush.color:=colrLine

end

else begin

pen.color:=colrBack; brush.color:=colrBack

end;

Ris; // ris -

end; end;

 

Procedure Tviz.Show;

begin

Draw(true);

end;

 

Procedure Tviz.Hide;

begin

Draw(false);

end;

procedure Tviz.MovTo;

begin

Hide;

x:=x+dx; y:=y+dy; r:=r+dr; //

Show;

end;

 

Constructor TKrug.Create; //

begin // - ,

colrLine:=colrLine0; // Tkvad

canvas:=canvas0;

x:=x0; y:=y0; r:=r0;

end;

 

Procedure Tkrug.Ris; //

Begin

x1:=x-r; x2:=x+r; y1:=y-r; y2:=y+r;

Canvas.Ellipse(x1,y1,x2,y2);

end;

 

Procedure Tkvad.ris; //

Begin

x1:=x-r; x2:=x+r; y1:=y-r; y2:=y+r;

Canvas.Rectangle(x1,y1,x2,y2);

end;

 

Constructor TKrpr.Create; //

Begin //

dy1:=dy0;

Inherited Create(x0,y0,r0,colrLine0,canvas0); // TKrug

end;

 

Procedure TkrPr.Ris; //

begin

Inherited ris //

Canvas.Rectangle(x1,y2,x2,y2+dy1);

end;

end.

10.2.

unit Unit10;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Buttons, ExtCtrls;

type

TForm1 = class(TForm)

Button1: TButton;

Button2: TButton;

Button3: TButton;

Button4: TButton;

Button5: TButton;

Button6: TButton;

Button7: TButton;

Button8: TButton;

BitBtn1: TBitBtn;

Image1: TImage;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure Button6Click(Sender: TObject);

procedure Button7Click(Sender: TObject);

procedure Button8Click(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

private { Private declarations }

public { Public declarations }

end;

var Form1: TForm1;

implementation

{$R *.dfm}

uses unit2, Clipbrd;

var krug:Tkrug;

kvad:Tkvad;

krpr:Tkrpr;

okno1:Timage; //

pxm1,pym1, xo,yo,ro:word;

 

procedure TForm1.Button1Click(Sender: TObject); //

begin

okno1:=Form1.Image1;

colrBack:=clWhite; //

pxm1:=okno1.ClientWidth; //

pym1:=okno1.ClientHeight;

with okno1.canvas do begin

pen.color:=colrBack;

brush.color:=colrBack;

Rectangle(0,0,Pxm1,Pym1); //

end;

xo:=pxm1 div 2; yo:=pym1 div 2; //

ro:=10; //

Krug:=Tkrug.Create(xo,yo,ro,clBlack,okno1.canvas); //

Kvad:=Tkvad.Create(xo+80,yo,ro,clBlack,okno1.canvas);

Krpr:=Tkrpr.Create(xo-80,yo,ro,2*ro,clBlack,okno1.canvas);

krug.Show; //

kvad.Show; //

Krpr.show; //

end;

 

procedure TForm1.Button2Click(Sender: TObject);

begin //

Krug.MovTo(0,0,3);

end;

 

procedure TForm1.Button3Click(Sender: TObject);

begin // -

Kvad.MovTo(3,3,0);

end;

 

procedure TForm1.Button4Click(Sender: TObject);

begin // -

krpr.MovTo(10,0,0);

okno1.Update; //

sleep(200); //

krpr.MovTo(0,5,0);

end;

 

procedure TForm1.Button5Click(Sender: TObject);

begin //

Krug.MovTo(0,0,-3);

end;

 

procedure TForm1.Button6Click(Sender: TObject);

begin // -

Kvad.MovTo(-3,-3,0);

end;

 

procedure TForm1.Button7Click(Sender: TObject);

begin // -

krpr.MovTo(-10,0,0);

okno1.Update;

sleep(200);

krpr.MovTo(0,-5,0);

end;

 

procedure TForm1.Button8Click(Sender: TObject);

begin // TImage!!!

Clipboard.Assign(Image1.Picture);

end;

 

 

procedure TForm1.BitBtn1Click(Sender: TObject);

begin

krug.Free; kvad.Free; Krpr.Free;

end;

end.

10.7.

.

- -, , ( ). .

1. . .

2. ( 2 ). .

3. . .

4. . .

5. , . .

6. , . .

7. . .

8. , . .

9. , . .

10. , . .

11. , . .

12. , . .

13. , .

14. , . .

15. , . .


1.

( ).

Function StrToFloat(St: String): Extended; St .
Function StrToInt(St: String): Integer; St .
Procedure Val(St: String; var X; Code: Integer); St X, . Code ,
Function FloatToStr(Value: Extended): String; Value
Function FloatToStrF(Value: Extended; Format: TFloatFor-mat; Precision, Digits: Integer): String; Value Precision Digits (. )
Procedure Str(X [:width [:Decimals]]; var St: String); St; Width Decimals, ,
FloatToStrF
Format
fFfExponent . Precision . Digits - XX.
ffFixed . Precision . Digits - . : 3,14
ffGeneral , . ffFixed, Precision, - 0,00001, ffExponent: 3,1416
ffNumber ffFixed - ( Windows )
ffCurrency . ffNumber, ( Windows - .). Value = p*1000 : 3 141,60
     

 


2.

Object Pascal (|x| abs (x), Arctg(x) ArcTan(x), ex Exp(x), p Pi, Sqrt(x), x2 Sqr(x), Ln(x), Cos(x), Sin (x) .). Math. .

 

Math
    LogN (a, x)
    Power (x,a)
    Tan (x)
    CoTan (x)
    ArcSin (x)
    ArcCos (x)
   
    Sinh (x)
    Cosh (x)
  1, x >0; 0, x =0; -1, x <0  

 


1. .. Delphi 7. .: ̔, 2003.

2. .. Delphi 6. . ‑.: .., 2001.

3.. . . , -, . 2001.

4. .. , .. , .. . Delphi. . . . 1. ., , 2004.

5. . . Delphi. . ., , 2005.

 


. 2005, .

 

 

,

.

 

 

DELPHI.

 

1 2-

 

 

 

 

68x84 1/16.

. . Times

. . . 5,0. . . . 4,5. 500 .

 

 

:

156 05.02.2001.

509 03.08.2001.

220013, , . , 6

 





:


: 2016-11-18; !; : 780 |


:

:

, , .
==> ...

1621 - | 1301 -


© 2015-2024 lektsii.org - -

: 0.155 .