|
x0,y0: integer; dx,dy: integer; i: integer
|
bet | 2/3 | Sana | 17.02.2024 | Hajmi | 87,03 Kb. | | #158299 |
Bog'liq DELPHI DASTURLASH TILIDA GEOMETRIK CHIZMALARx0,y0: integer; dx,dy: integer; i: integer;
begin
x0 := 100; y0 := 200; dx :=5; dy := 5;
for i:=1 to 50 do begin
gr[i].x := x0 + (i-1)*dx;
gr[i].y := y0 + (i-1)*dy;
end;
with form1.Canvas do begin
MoveTo(x0,y0); LineTo(x0,10);
MoveTo(x0,y0); LineTo(200,y0);
Polyline(gr);
end;
end;
end.
Dastur natijasi:
2-rasm. Tutash chiziq chizish dasturi.
y=x funksiyaning grafigini hosil qilish
Bu grafikning forma oynasida hosil qilish uchun, formani loyihalashtiruvchi oynasini ishga tushiramiz va “Button1” tugmachasini hosil qilamiz va dasturlash maydonchasiga quyidagi dasturni kiritamiz:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var Form1: TForm1;
implementation
{$R *.dfm}
Function f(x:real):real;
begin f:=x;end;
procedure GrOfFunc;
var x1,x2:real; y1,y2:real; x:real; y:real;dx:real;
l,b:integer; w,h:integer; mx,my:real; x0,y0:integer;
begin
l:=10;b:=Form1.ClientHeight-20; h:=Form1.ClientHeight-40; w:=Form1.Width-40;
|
| |