Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, Buttons, Spin, ExtCtrls, Math;
- type
- TForm1 = class(TForm)
- Panel1: TPanel;
- Panel2: TPanel;
- Panel3: TPanel;
- Label1: TLabel;
- SpinEdit1: TSpinEdit;
- SpinEdit2: TSpinEdit;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- SpinEdit3: TSpinEdit;
- BitBtn1: TBitBtn;
- BitBtn2: TBitBtn;
- Button1: TButton;
- Memo1: TMemo;
- Image1: TImage;
- procedure BitBtn1Click(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- var ad, ab, alf, i, x, y:integer;//alf - óãîë, à - îñíîâàíèå(íèç), â - ëåâûé áîê
- {$R *.dfm}
- procedure osnovanie;
- begin
- ad:=form1.SpinEdit1.Value;
- ad:=ad*10;
- x := form1.Image1.width div 2;
- y := form1.Image1.Height div 2;
- with form1.Image1.Canvas do
- begin
- pen.width := 3;
- pen.Style := pssolid;
- brush.Color := clwhite;
- Rectangle(0,0,Form1.Image1.Width,
- Form1.Image1.Height);
- fillrect(cliprect);
- moveto(x - ad, y);
- lineto(x + ad, y);
- font.Size := 16;
- textout(x - ad - 15, y + 2, 'A');
- textout(x + ad + 3, y + 2, 'D');
- end;
- form1.Memo1.Text := 'Ñ ïîìîùüþ ëèíåéêè îòëîæèì îòðåçîê = ' +
- inttostr(form1.SpinEdit1.Value) + 'ñì.';
- end;
- procedure ugolalf;
- var
- a,b: TPoint;
- ab, ad:integer;
- gradus:real;
- begin
- ab:=form1.SpinEdit2.Value * 10;
- ad:=form1.SpinEdit1.Value * 10;
- gradus:=form1.SpinEdit3.Value/180*pi;
- a.X:=x-ad;
- a.Y:=y;
- b.X:=a.X+round(ab*cos(gradus));
- b.Y:=a.Y-round(ab*sin(gradus));
- with form1.Image1.Canvas do
- begin
- pen.Width:=3;
- pen.Color:=clblack;
- pen.Style:=pssolid;
- moveto(a.X,a.Y);
- lineto(b.X,b.y);
- font.Size := 16;
- textout(b.X-20,b.Y-25,'B');
- end;
- Form1.Memo1.Text:='Ïðè ïîìîùè òðàíñïîðòèðà,÷åðåç òî÷êó À ïðîâåäåì ïðÿìóþ, ïîä óãëîì '+inttostr(form1.SpinEdit3.Value)+'°, äëèíîé '+inttostr(form1.SpinEdit2.Value)+'cì. Ïîñòàâèì òî÷êó B.';
- end;
- procedure verhosn;
- var b, a, c:Tpoint;
- ad, ab:integer;
- gradus:real;
- begin
- ab:=form1.SpinEdit2.Value * 10;
- ad:=form1.SpinEdit1.Value * 10;
- gradus:=form1.SpinEdit3.Value/180*pi;
- with form1.Image1.Canvas do
- begin
- b.X:=a.X+round(ab*cos(gradus));
- b.Y:=a.Y-round(ab*sin(gradus));
- c.x:=(a.X+round(ab*cos(gradus))) + ad;
- c.Y:=a.Y-round(ab*sin(gradus));
- pen.Width:=3;
- pen.Color:=clblack;
- pen.Style:=pssolid;
- moveto(b.x, b.y);
- lineto(c.X, c.y);
- font.Size := 16;
- textout(c.X+20,c.Y-25,'C')
- end;
- Form1.Memo1.Text:='Äàëåå, ïðè ïîìîùè ëèíåéêè, ïðîâåäåì îòðåçîê îò òî÷êè  äî òî÷êè Ñ. Òàê êàê íàøà ôèãóðà - ïàðàëëåëîãðàìì, ýòîò îòðåçîê áóäåò ðàâåí îòðåçêó ÀD.';
- end;
- procedure TForm1.BitBtn1Click(Sender: TObject);
- begin
- i:=i+1; // âû÷èñëåíèå çíà÷åíèÿ êëþ÷à âûáîðà
- Case i of
- 1: osnovanie;
- 2: ugolalf;
- 3: verhosn;
- end;
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- close
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement