unit rob1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
ScrollBar1: TScrollBar;
ScrollBar2: TScrollBar;
procedure Button1Click(Sender: TObject);
procedure ScrollBar1Change(Sender: TObject);
procedure ScrollBar2Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
x,y,yy,x0,y0,x1,y1 : longint ;
xx,yyy:real;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
x0:= 450;
y0:= 250;
x1:= 550;
y1:= 250;
scrollbar1.Position:=0;
scrollbar2.Position:=0;
canvas.Pen.Color:=clred ;
canvas.MoveTo(350,350);
canvas.LineTo(350,250);
canvas.LineTo(x0,y0);
canvas.LineTo(x1,y1);
procedure TForm1.ScrollBar1Change(Sender: TObject);
canvas.Pen.Color:=clwhite ;
canvas.MoveTo(350,250);
y:= (scrollbar1.Position);
xx:= sin(y/200);
y0:=trunc(250-(xx*100));
yyy:=cos(y/200);
x0:=trunc(350+(yyy*100));
y1:=y0-yy;
y1:=y0-trunc(sin((scrollbar2.Position)/200)*100);
x1:=x0+trunc(cos((scrollbar2.Position)/200)*100);
procedure TForm1.ScrollBar2Change(Sender: TObject);
canvas.MoveTo(x0,y0);
end.
umts