由VB6.0 gui生成matlab的m文件

源代码在线查看: script_resize.m

软件大小: 25 K
上传用户: kelvinitc
关键词: matlab 6.0 gui VB
下载地址: 免注册下载 普通下载 VIP

相关代码

				function script_resize(fig)
				%   Resizes the objects within the window, keeping their original size and position
				%   relative to upper left corner.
				
				%   Martin Dale, July 2002
				%   Copyright 2002   All Rights Reserved.
				%   Version 1.00   9 June 2002
				%   Contact Martin.Dale@Physics.org
				
				handles=get(0,'userdata');
				names=fieldnames(handles);
				for a=1:length(names)
				    eval([names{a},'=handles.',names{a},';']);
				end
				
				kids=get(fig,'children');
				kids=sort(kids);
				for i=1:length(kids)
				   data=get(kids(i),'userdata');
				   if (isfield(data,'left'))
				      formsize=get(eval(data.virtualparent),'position')*20; % get the position of the virtual parent
				      %get position relative to virtual parent
				   	if isempty([findstr(data.virtualparent,'form') findstr(data.virtualparent,'frm')])
				         % set the position of the control relative to its virtual parent i.e. a frame
				         pos=[formsize(1) + str2num(data.left), formsize(2)+ formsize(4) - str2num(data.top) - str2num(data.height), str2num(data.width), str2num(data.height)]/20;
				      else
				         % set the position of the control relative to its parent i.e. a figure window
				         pos=[str2num(data.left), formsize(4)- str2num(data.top) - str2num(data.height), str2num(data.width), str2num(data.height)]/20;
				      end
				      
				      set(eval(data.handle),'position',pos);
				
				      if isfield(data,'framelabel');
				         ext=get(eval(data.framelabel),'extent');
				         set(eval(data.framelabel),'Position',[pos(1)+9, pos(2)+pos(4)-0.5*ext(4), ext(3), ext(4)]);
				      end
				   end
				end
				
				
				
							

相关资源