Вот переписал, но с увеличением и уменьшением нечего не получается.
Код
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Button1: TButton;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var xtmin,xtmax:integer;
procedure show_f(mx,my:integer; ssx,ssy:double; xma,xmi:integer);
var x,y:array[1..10]of real;
i:integer;
h:real;
xmin,xmax,ymin,ymax,sx,sy:double;
begin
Form1.Image1.Refresh;
Form1.Image1.Canvas.Pen.Style:=psSolid;
Form1.Image1.Canvas.Rectangle(0,0,500,300);
h:=0.94;
i:=1;
for i:=1 to 9 do begin
x[i]:=h;
y[i]:=(((sin(h/2)/cos(h/2)))+cos(h))/(sin(1/h));
h:=h+0.94;
end;
xmin:=x[1]; xmax:=x[1]; ymin:=y[1]; ymax:=y[1];
for i:=2 to 9 do begin
if y[i]<ymin then ymin:=y[i];
if y[i]>ymax then ymax:=y[i];
if x[i]<xmin then xmin:=x[i]
if x[i]>xmax then xmax:=x[i];
end;
sx:=Form1.Image1.Width/(xmax-xmin);
sy:=Form1.Image1.Height/(ymax-ymin);
with Form1.Image1.Canvas do begin
moveto(trunc(sx*(x[1]-xmin)),Form1.Image1.height-trunc(sy*(y[1]-ymin)));
for i:=2 to 9 do begin
Lineto(trunc(sx*(x[i]-xmin)),Form1.Image1.height-trunc(sy*(y[i]-ymin)));
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
show_f(1,1,1,1,1,1);
end;
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button=mbLeft then begin
??????????????????????? ++++ ???????????????????????????
// xtmax:=xtmax+1; xtmin:=xtmax-1;
// show_f(1,1,1,1,xtmax,xtmin);
end;
if Button=mbRight then begin
??????????????????????? ----- ???????????????????????????
// xtmax:=xtmax-1; xtmin:=xtmax+1;
// show_f(1,1,1,1,xtmax,xtmin);
end;
end;
end.
[b][/b][b]