جناب Delphi_7 این مقدار کد برای شروع تان باید مناسب باشد کد زیر ایتدائی ترین کارگرافیک هست ولی کد زیر مفهوم مطلبی که نقطه صفر را مرکز قرار میدهد را بصورت عملی نشان میدهد (فقط یک button را به فرمتان اضافه و unit را با کدهی زیر تعویض کنید.)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, math;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure DrawArrow;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
// sin(d*3.14159f/180);
procedure TForm1.DrawArrow;
var
center_x, center_y : integer;
begin
center_x := Round(Width/2);
center_y := Round(Height/2);
Canvas.Pen.Color := RGB(0, 0, 0);
Canvas.MoveTo(center_x, center_y-Round(Height/4));
Canvas.LineTo(center_x, Round(Height)-Round(Height/4));
Canvas.Pen.Color := RGB(0, 0, 0);
Canvas.MoveTo(Round(Width/2)-Round(Width/4), center_y);
Canvas.LineTo(Round(Width)-Round(Width/4), center_y);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i, x, y : integer;
center_x, center_y : integer;
begin
DrawArrow;
center_x := Round(Width/2);
center_y := Round(Height/2);
x := -100;
y := Round(0.02-0.05*x);
Canvas.Pen.Color := RGB(255, 2, 2);
Canvas.MoveTo(center_x+x, center_y+y);
for i:=-100 to 100 do
begin
x := i;
y := Round(0.02-0.05*x);
Canvas.LineTo(center_x+x, center_y+y);
end;
end;
end.