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

    function newobj = printcopy(obj, fig)
%PRINTCOPY Create a new component for printing the component display 
%
%  NEWOBJ = PRINTCOPY(OBJ, FIG) creates and returns a handle to a new
%  component, NEWOBJ, parented by the specified figure, FIG.  The new
%  object will be used for printing a copy of the component OBJ.
%  Scrollaxes create a non-scrolling set of axes that display the entire x
%  and y limits.

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


xl = obj.xlim;
yl = obj.ylim;
newobj = copyobj(obj.AxesHandle, fig);
set(newobj, 'ButtonDownFcn', '', 'XLim', xl, 'YLim', yl);


Brd = [1 1 1 1];
if ~isempty(get(obj.AxesHandle, 'XTickLabel'))
    Brd(2) = 20;
    Brd(4) = 10;
end
if ~isempty(get(obj.AxesHandle, 'YTickLabel'))
    Brd(1) = 35;
    Brd(3) = 10;
end
if ~isempty(get(get(obj.AxesHandle, 'Title'), 'String'))
    Brd(4) = Brd(4) + 20;
end
if ~isempty(get(get(obj.AxesHandle, 'XLabel'), 'String'))
    Brd(2) = Brd(2) + 15;
end
if ~isempty(get(get(obj.AxesHandle, 'YLabel'), 'String'))
    Brd(1) = Brd(1) + 15;
end

% Add a border so that axes box is correctly printed
newobj = mbcgui.widget.AxesPanel(...
    'AxesHandle', newobj, ...
    'Border', Brd);