我估计这位朋友是说的滚屏吧?
在ScrollBox里放一Image,设定 :Image.AutoSize :=True;
private
{ Private declarations }
procedure WMEraseBkgnd(var m:TWMEraseBkgnd); message WM_ERASEBKGND;
var
Form1: TForm1;
Draw : Boolean;
StartPt,MovePt : TPoint;
implementation
{$R *.DFM}
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Draw :=True;
StartPt :=Point(x,y);
end;
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if Draw then
begin
MovePt :=Point(x,y);
Form1.VertScrollBar.Position :=Form1.VertScrollBar.Position+StartPt.y-MovePt.y;
Form1.HorzScrollBar.Position :=Form1.HorzScrollBar.Position+StartPt.x-MovePt.x;
end;
Image1.Invalidate ;
end;
procedure TForm1.WMEraseBkgnd(var m:TWMERASEBKGND);
begin
m.Result := LRESULT(False);
end;
procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Draw := False;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Draw := False;
end;