Advertisement
Guest User

govnoizjopu v.2.0

a guest
Jun 9th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 3.36 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, StdCtrls, Buttons, Spin, ExtCtrls, Math;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Panel1: TPanel;
  12.     Panel2: TPanel;
  13.     Panel3: TPanel;
  14.     Label1: TLabel;
  15.     SpinEdit1: TSpinEdit;
  16.     SpinEdit2: TSpinEdit;
  17.     Label2: TLabel;
  18.     Label3: TLabel;
  19.     Label4: TLabel;
  20.     SpinEdit3: TSpinEdit;
  21.     BitBtn1: TBitBtn;
  22.     BitBtn2: TBitBtn;
  23.     Button1: TButton;
  24.     Memo1: TMemo;
  25.     Image1: TImage;
  26.     procedure BitBtn1Click(Sender: TObject);
  27.     procedure Button1Click(Sender: TObject);
  28.   private
  29.     { Private declarations }
  30.   public
  31.     { Public declarations }
  32.   end;
  33.  
  34. var
  35.   Form1: TForm1;
  36.  
  37. implementation
  38. var ad, ab, alf, i, x, y:integer;//alf - óãîë, à - îñíîâàíèå(íèç), â - ëåâûé áîê
  39.  
  40.  
  41. {$R *.dfm}
  42.  
  43.  
  44. procedure osnovanie;
  45. begin
  46. ad:=form1.SpinEdit1.Value;
  47. ad:=ad*10;
  48. x := form1.Image1.width div 2;
  49. y := form1.Image1.Height div 2;
  50.   with form1.Image1.Canvas do
  51.     begin
  52.       pen.width := 3;
  53.       pen.Style := pssolid;
  54.       brush.Color := clwhite;
  55.       Rectangle(0,0,Form1.Image1.Width,
  56.       Form1.Image1.Height);
  57.       fillrect(cliprect);
  58.       moveto(x - ad, y);
  59.       lineto(x + ad, y);
  60.       font.Size := 16;
  61.       textout(x - ad - 15, y + 2, 'A');
  62.       textout(x + ad + 3, y  + 2, 'D');
  63.   end;
  64.   form1.Memo1.Text := 'Ñ ïîìîùüþ ëèíåéêè îòëîæèì îòðåçîê = ' +
  65.     inttostr(form1.SpinEdit1.Value) + 'ñì.';
  66.  
  67. end;
  68.  
  69.  
  70.  
  71. procedure ugolalf;
  72. var
  73. a,b: TPoint;
  74. ab, ad:integer;
  75. gradus:real;
  76. begin
  77. ab:=form1.SpinEdit2.Value * 10;
  78. ad:=form1.SpinEdit1.Value * 10;
  79. gradus:=form1.SpinEdit3.Value/180*pi;
  80. a.X:=x-ad;
  81. a.Y:=y;
  82. b.X:=a.X+round(ab*cos(gradus));
  83. b.Y:=a.Y-round(ab*sin(gradus));
  84. with form1.Image1.Canvas do
  85.     begin
  86.     pen.Width:=3;
  87.     pen.Color:=clblack;
  88.     pen.Style:=pssolid;
  89.     moveto(a.X,a.Y);
  90.     lineto(b.X,b.y);
  91.     font.Size := 16;
  92.     textout(b.X-20,b.Y-25,'B');
  93.     end;
  94.   Form1.Memo1.Text:='Ïðè ïîìîùè òðàíñïîðòèðà,÷åðåç òî÷êó À ïðîâåäåì ïðÿìóþ, ïîä óãëîì '+inttostr(form1.SpinEdit3.Value)+'°, äëèíîé '+inttostr(form1.SpinEdit2.Value)+'cì. Ïîñòàâèì òî÷êó B.';
  95. end;
  96.  
  97. procedure verhosn;
  98. var b, a, c:Tpoint;
  99. ad, ab:integer;
  100. gradus:real;
  101. begin
  102. ab:=form1.SpinEdit2.Value * 10;
  103. ad:=form1.SpinEdit1.Value * 10;
  104. gradus:=form1.SpinEdit3.Value/180*pi;
  105. with form1.Image1.Canvas do
  106. begin
  107. b.X:=a.X+round(ab*cos(gradus));
  108. b.Y:=a.Y-round(ab*sin(gradus));
  109.   c.x:=(a.X+round(ab*cos(gradus))) + ad;
  110.   c.Y:=a.Y-round(ab*sin(gradus));
  111.       pen.Width:=3;
  112.       pen.Color:=clblack;
  113.       pen.Style:=pssolid;
  114.         moveto(b.x, b.y);
  115.         lineto(c.X, c.y);
  116.         font.Size := 16;
  117.         textout(c.X+20,c.Y-25,'C')
  118. end;
  119. Form1.Memo1.Text:='Äàëåå, ïðè ïîìîùè ëèíåéêè, ïðîâåäåì îòðåçîê îò òî÷êè  äî òî÷êè Ñ. Òàê êàê íàøà ôèãóðà - ïàðàëëåëîãðàìì, ýòîò îòðåçîê áóäåò ðàâåí îòðåçêó ÀD.';
  120. end;
  121.  
  122. procedure TForm1.BitBtn1Click(Sender: TObject);
  123. begin
  124. i:=i+1; // âû÷èñëåíèå çíà÷åíèÿ êëþ÷à âûáîðà
  125. Case i of
  126. 1: osnovanie;
  127. 2: ugolalf;
  128. 3: verhosn;
  129. end;
  130. end;
  131.  
  132.  
  133.  
  134. procedure TForm1.Button1Click(Sender: TObject);
  135. begin
  136. close
  137. end;
  138.  
  139. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement