http://www.wrzucaj.com/551343
ktos mi moze powiedziec jak napisac kod do takiego programu?Nie mam kompletnie pojecia jak to zrobic, jedyne co mam to tylko to:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, XPMan, StdCtrls, ExtCtrls, Spin,Math;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Image: TImage;
Button1: TButton;
XPManifest1: TXPManifest;
Button2: TButton;
SpinX0: TSpinEdit;
SpinY0: TSpinEdit;
SpinSkala: TSpinEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
m:integer = 20;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
x0, y0, skala, w_image, h_image,yp,y,x,xp: integer;
begin
x0 := spinX0.Value;
y0 := spinY0.Value;
skala := spinSkala.Value;
w_image := Image.Width;
h_image := Image.Height;
image.canvas.Brush.Color := rgb (255,255,255);
image.Canvas.Rectangle(0,0,w_image,h_image);
image.Canvas.MoveTo(m,y0);
image.Canvas.LineTo(w_image-m,y0);
image.Canvas.Brush.Color:= rgb (0,0,0);
image.Canvas.Polygon([Point(w_image-m, y0),Point(w_image-m-10,y0-5),Point(w_image-m-10,y0+5)]);
image.Canvas.MoveTo(x0,m);
image.Canvas.LineTo(x0,h_image-m);
image.Canvas.Brush.Color:= rgb (0,0,0);
image.Canvas.Polygon([Point(x0,m),Point(x0-5,m+10),Point(x0+5,m+10)]);
y:=0;
yp:= y0;
while (yp > m + skala) do
begin
yp:= yp - skala;
y:= y +1;
image.Canvas.Brush.Style := bsclear;
image.Canvas.textout(x0+6,yp-4,IntToStr(y));
image.Canvas.MoveTo(x0-3,yp);
image.Canvas.LineTo(x0+3,yp);
end;
y:= 0;
yp:= y0;
while (yp<h_image - skala) do
begin
yp:= yp + skala;
y:=y-1;
image.Canvas.Brush.Style := bsclear;
image.Canvas.textout(x0+6,yp-4,IntToStr(y));
image.Canvas.MoveTo(x0-3,yp);
image.Canvas.LineTo(x0+3,yp);
end;
x:=0;
xp:=x0;
while(xp>m) do
begin
xp:=xp-skala;
x:=x-1;
image.Canvas.Brush.Style:=bsclear;
image.Canvas.TextOut(xp,y0+6,IntToStr(x));
image.Canvas.MoveTo(xp,y0-3);
image.Canvas.LineTo(xp,y0+3);
end;
x:=0;
xp:=x0;
while (xp<w_image+skala) do
begin
xp:=xp +skala;
x:= x+1;
image.Canvas.Brush.Style:=bsclear;
image.Canvas.TextOut(xp,y0+6,IntToStr(x));
image.Canvas.MoveTo(xp,y0-3);
image.Canvas.LineTo(xp,y0+3);
end;
xp:=x0;
while (xp<w_image +skala) do
begin
xp:=xp+skala;
image.Canvas.Pen.Color:=rgb(192,192,192);
image.Canvas.Polygon([point(xp,m),point(xp,h_image-m)]);
end;
xp:=x0;
while (xp>m) do
begin
xp:=xp-skala;
image.Canvas.Pen.Color:=rgb(192,192,192);
image.Canvas.Polygon([point(xp,m),point(xp,h_image-m)]);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
x0, y0, skala, w_image, h_image,y,x,xs,xe: integer;
begin
x0 := spinX0.Value;
y0 := spinY0.Value;
skala := spinSkala.Value;
w_image := Image.Width;
h_image := Image.Height;
xs := 0 - x0 + m;
xe := xs + w_image - 2*m;
image.Canvas.MoveTo(m,(round(sin(DegtoRad(xs))*skala*(-1))+y0));
for x := m to w_image - 2*m do
begin
image.Canvas.LineTo(x,(round(sin(degToRad(x-m+xs))*skala*(-1))+y0));
end;
end;