发表用户:讨论贴
收集整理:James.Liu
相关讨论:http://www.mygis.com.cn/forum/dispbbs.asp?BoardID=4&ID=2183
信息原始来源:James MapInfo技术论坛

文章标题:如何实现MAPX控件的水平垂直滚动条

fireline99

如何实现MAPX控件的水平垂直滚动条
如题

abigfish :

procedure TForm1.Timer1Timer(Sender: TObject);
var
   xp,yp,xr,yr,w,h:integer;
begin
   if (map1.Top<>0) or (map1.Left<>0) then
   begin
   xp:=scrollbox1.HorzScrollBar.Position;
   yp:=scrollbox1.VertScrollBar.Position;
   xr:=scrollbox1.HorzScrollBar.Range;
   yr:=scrollbox1.VertScrollBar.Range;
   w:=map1.Width;
   h:=map1.Height;
   map1.CenterX:=(xp-(xr-w)/2)*(map2.Bounds.XMax-map2.Bounds.XMin)/xr+map2.CenterX;
   map1.CenterY:=-(yp-(yr-h)/2)*(map2.Bounds.YMax-map2.Bounds.YMin)/yr+map2.CenterY;
   map1.Top:=0;
   map1.Left:=0;
   end;
//<<<<<<<*****************************************************
end;