.


:




:

































 

 

 

 


6.




3 , .. , . ( TRadioGroup) , ( TEdit), ( TLabel). ( TButton): , .

( TImage) . .

 

, p , .

 

:

Rectangle Ellipse MoveTo LineTo   ,

 

 

Name = 'MainForm'

Caption = ' 6'

 

:

Figure: TRadioGroup

Caption =

Items = ('', '', '')

 

:

Label1: TLabel

Caption = ' '

 

Label2: TLabel

Caption = 'a'

 

Label3: TLabel

Caption = 'b'

:

ra: TEdit

rb: TEdit

ta: TEdit

tb: TEdit

tc: TEdit

cr: TEdit

 

:

Button1: TButton

Caption =

OnClick = Button1Click

 

Button2: TButton

Caption =

OnClick = Button2Click

 

:

Image: TImage

Transparent = True

 

unit Main;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics,

Controls, Forms, Dialogs, StdCtrls, ExtCtrls;

type

TMainForm = class(TForm)

Figure: TRadioGroup;

ra: TEdit;

rb: TEdit;

ta: TEdit;

tb: TEdit;

tc: TEdit;

cr: TEdit;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Button1: TButton;

Button2: TButton;

Image: TImage;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

MainForm: TMainForm;

implementation

{$R *.DFM}

procedure TMainForm.Button1Click(Sender: TObject);

var

a,b,c,r,p,s,h:Real;

begin

with Image.Picture.Bitmap do

begin

Width:=0; { }

Height:=0;

Width:=Image.Width;

Height:=Image.Width;

end;

 

case Figure.ItemIndex of

0:begin

a:=StrToFloat(ra.Text);

b:=StrToFloat(rb.Text);

if (a<=0) or (b<=0) then

ShowMessage(' ')

else

begin

ShowMessage(' '+

FloatToStr(a*b));

with Image.Picture.Bitmap.Canvas do

Rectangle(0,0,Round(a),Round(b));

end;

end;

1:begin

a:=StrToFloat(ta.Text);

b:=StrToFloat(tb.Text);

c:=StrToFloat(tc.Text);

if (a<=0) or (b<=0) or (c<=0) then

ShowMessage(' ')

else

if (a+b<=c) or (b+c<=a) or (a+c<=b) then

ShowMessage(' ')

else

begin

p:=(a+b+c)/2;

s:=Sqrt(p*(p-a)*(p-b)*(p-c));

ShowMessage(' '+

FloatToStr(s));

with Image.Picture.Bitmap.Canvas do

begin

MoveTo(0,0);

LineTo(Round(a),0);

h:=2*s/a;

LineTo(Round(Sqrt(Sqr(c)-Sqr(h))),

Round(h));

LineTo(0,0);

end;

end;

end;

2:begin

r:=StrToFloat(cr.Text);

if r<=0 then

ShowMessage(' ')

else

begin

ShowMessage(' '+

FloatToStr(Pi*Sqr(r)));

with Image.Picture.Bitmap.Canvas do

Ellipse(0,0,Round(2*r),Round(2*r));

end;

end;

end;

end;

 

procedure TMainForm.Button2Click(Sender: TObject);

begin

Close;

end;

end.

 

1. .. Delphi 5. 2- ., . . .: , 2000.

2. ., ., . . .: , 1979.

3. .., .., .. . : ; --: , 1997.

4. .. . .: , 1977.

5. . : / . .. . .: , 2002.

6. . . .: , 1977. .1.

7. . . .: , 1977. .2.

8. .. Turbo Pascal 7.0 Delphi: . 2- . ; .; ; : BHV, 2000.

9. .. . : , 2000.

10. .. , . 2. .: , 1966.





:


: 2016-12-17; !; : 2317 |


:

:

- , 20 40 . - .
==> ...

949 - | 902 -


© 2015-2024 lektsii.org - -

: 0.019 .