www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@dialog/pSetDialogLocation.m
function pSetDialogLocation(obj) %PSETDIALOGLOCATION Private method to set the dialog's location. % % PSETDIALOGLOCATION(OBJ) % Copyright 2007-2010 The MathWorks, Inc. if ~isempty( obj.Figure ) % Work out the default position we want to use scr=get(0,'ScreenSize'); if ~isempty( obj.Owner ) figpos=get(obj.Owner,'Position'); defpos=[figpos(1:2)+(figpos(3:4)-obj.Size)./2 obj.Size]; else defpos=[(scr(3:4)-obj.Size)./2 obj.Size]; end % Set position if obj.PersistPosition xregpersistfigpos( obj.Figure, 'DefaultPos', defpos ); else set(obj.Figure, 'Position', defpos); end % Move figure to be entirely on screen xregmoveonscreen( obj.Figure ); end