procedure TForm1.FormCreate(Sender: TObject);
begin
IMAGE1.autosize := True; //加上这句
scrollbar1.Left:=image1.Left;
scrollbar1.Top:=image1.Top+image1.Height;
scrollbar1.Width:=image1.Width; //不能这样 应将IMAGE1和Scrollbar放在一个PANEL中IMAGE1的width大于PANEL1的WIDTH ScrollBar的Width=panel1.width;用align就行了
scrollbar1.Max:=image1.Picture.Width-scrollbar1.width;
scrollbar2.Left:=image1.Left+image1.Width;
scrollbar2.Top:=image1.Top;
scrollbar2.Height:=image1.Height;//不能这样,同上
Scrollbar2.Max:=image1.Picture.Height-scrollbar2.height;
end;
procedure TForm1.ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
image1.Left:=image1.left-Scrollbar1.Position;
end;