scriptform.m

来自「由VB6.0 gui生成matlab的m文件」· M 代码 · 共 30 行

M
30
字号
function scriptform(vb, fid)
%   Creates a figure window for each form in a Visual Basic Project.
%   Size is the same as in VB and sizes are referenced to top left corner.
%   Resize is relative to top right corner by use of RESIZEFCN "script_resize(gcf)"

%   Martin Dale, July 2002
%   Copyright 2002   All Rights Reserved.
%   Version 1.00   9 June 2002
%   Contact Martin.Dale@Physics.org

forms=fieldnames(vb.form);
for i=1:length(forms)
   thisform=eval(['vb.form.',char(forms(i))]);
   str=['pos=[',num2str(thisform.clientleft+120),', screen(4)-',num2str(thisform.clienttop),'-',num2str(thisform.clientheight),'-300, ',num2str(thisform.clientwidth),',',num2str(thisform.clientheight),']/20;'];
   fprintf(fid,['\n',str,'\n']);
   str=['control_info.handle=''',thisform.handle,''';'];
   fprintf(fid,[str,'\n']);
   str=['control_info.virtualparent=''0'';'];
   fprintf(fid,[str,'\n']);
   str=[thisform.handle,'=figure(''NumberTitle'',''off'',''Menubar'',''none'',''Name'',''',thisform.caption,''',''Units'',''points'',''Position'',pos,''userdata'',control_info);'];
   fprintf(fid,[str,'\n']);
   str2=['handlelist.',thisform.handle,'=',thisform.handle,';'];
   fprintf(fid,[str2,'\n']);
   str=['set(',thisform.handle,',''resizefcn'',''script_resize(gcf)'');'];
   fprintf(fid,[str,'\n']);
   str=['clear control_info;'];
   fprintf(fid, [str,'\n']);

end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?