www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@scrollaxes/pPostSetPosition.m

    function pPostSetPosition(h, event)
%PPOSTSETPOSITION React to position changes in parent
%

%  Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc.


pos = h.Position;
bord = h.InnerBorder;
innerpos = [bord(1)+1 bord(2)+1 pos(3)-bord(1)-bord(3) pos(4)-bord(2)-bord(4)];
innerpos = h.clipRect(innerpos, [1 1 pos(3:4)]);

w = h.decsize;

ht = min(w,pos(4));
w = min(w,pos(3));

% Position the scrollbars and corner button
set(h.HGobj,{'Position'},{...
      [innerpos(1) innerpos(2) max(1,innerpos(3)-w) ht];...
      [innerpos(1)+innerpos(3)-w innerpos(2)+ht w max(1,innerpos(4)-ht)];...
      [innerpos(1)+innerpos(3)-w innerpos(2) w ht]});
  
% Position the axes and panel
Axpos = [innerpos(1) innerpos(2)+1 max(innerpos(3:4)-[1 1], [1 1])];
set(h.AxesHandle, 'Position', Axpos);
set(h.PanelHandle, 'Position', pos);

% Update axes limits
h.doXlim;
h.doYlim;
h.doXdraw;
h.doYdraw;