Matlab 版 (精华区)
发信人: zjliu (秋天的萝卜), 信区: Matlab
标 题: 模拟figure函数
发信站: BBS 哈工大紫丁香站 (Mon Jun 21 08:59:10 2004)
下面的一段程序来模仿figure函数生成图形对话框,其中大部分的callback还未写好
figure('MenuBar','none');
pathq=pwd
menu1 =uimenu(gcf,'label','&File');
menu11=uimenu(menu1,'label','&New figure','Accelerator','N','callback','figure
');
menu12=uimenu(menu1,'label','&Open...','Accelerator','O',...
'callback',['[filename, pathname] = uigetfile({''*.*''},''Open'');',...
'eval([''open '',[pathname,filename]]);']);
menu13=uimenu(menu1,'label','&Close...','Accelerator','W',...
'callback','close');
menu14=uimenu(menu1,'label','&Save...','Accelerator','S','separator','on',...
'callback',['[filename, pathname] = uiputfile(''*.fig'',''Save'');',...
'saveas(gcf,[filename,''.fig'']);']);
menu15=uimenu(menu1,'label','&Save as...',...
'callback',['[filename, pathname] = uiputfile(''*.fig'',''Save'');',...
'eval([''cd '',pathname]);','saveas(gcf,[filename,''.fig'']);',...
'eval([''cd '',pathq]);']);
menu16=uimenu(menu1,'label','&Export...',...
'callback',['uiputfile({''*.emf'';''*.bmp'';''*.eps'';''*.ai'';'...
'''*.jpg'';''*.tif'';''*.png'';''*.pcx'';''*.pbm'';''*.pgm''',...
';''*.ppm''},''Export'');']);
menu17=uimenu(menu1,'label','&Preferences...','separator','on',...
'callback','Preferences;');
menu18=uimenu(menu1,'label','&Page Setup...','separator','on',...
'callback','pagesetupdlg ;');
menu19=uimenu(menu1,'label','&Print Setup...',...
'callback','printdlg;');
menu110=uimenu(menu1,'label','&Print Preview...',...
'callback','printpreview;');
menu111=uimenu(menu1,'label','&Print...','Accelerator','P',...
'callback','printdlg;');
menu2 =uimenu(gcf,'label','&Edit');
menu21=uimenu(menu2,'label','&Undo','enable','off');
menu22=uimenu(menu2,'label','&Cut ',...
'separator','on','Accelerator','X','enable','off');
menu23=uimenu(menu2,'label','&Copy','Accelerator','C','enable','off');
menu24=uimenu(menu2,'label','&Paste','Accelerator','V','enable','off');
menu25=uimenu(menu2,'label','&Clear','enable','off');
menu26=uimenu(menu2,'label','&Select All','Accelerator','A','separator','on');
menu27=uimenu(menu2,'label','Copy &Figure','separator','on');
menu28=uimenu(menu2,'label','Copy &Options',...
'callback','Preferences(''Copy Options'');');
menu29=uimenu(menu2,'label','F&igure Properties...','separator','on',...
'callback','propedit');
menu210=uimenu(menu2,'label','&Axes Properties...',...
'callback','propedit(gca);');
menu211=uimenu(menu2,'label','C&urrent Object Properties...',...
'callback','propedit(gco)');
menu212=uimenu(menu2,'label','Color&map...',...
'callback','colormapeditor;');
menu3 =uimenu(gcf,'label','&View');
menu31=uimenu(menu3,'label','&Figure Toolbar',...
'callback','set(menu31,''checked'',''on'');');
menu32=uimenu(menu3,'label','&Camera Toolbar',...
'callback','set(menu32,''checked'',''on'');');
menu4 =uimenu(gcf,'label','&Insert');
menu41=uimenu(menu4,'label','&X Label');
menu42=uimenu(menu4,'label','&Y Label');
menu43=uimenu(menu4,'label','&Z Label','enable','off');
menu44=uimenu(menu4,'label','&Title');
menu45=uimenu(menu4,'label','&Legend','separator','on');
menu46=uimenu(menu4,'label','&Colorbar');
menu47=uimenu(menu4,'label','A&rrow','separator','on');
menu48=uimenu(menu4,'label','Li&ne');
menu49=uimenu(menu4,'label','T&ext');
menu410=uimenu(menu4,'label','&Axes','separator','on');
menu411=uimenu(menu4,'label','L&ight');
menu5 =uimenu(gcf,'label','&Tools');
menu51=uimenu(menu5,'label','&Edit plot');
menu52=uimenu(menu5,'label','&Zoom In');
menu53=uimenu(menu5,'label','Zoom Out');
menu54=uimenu(menu5,'label','&Rotate 3D');
menu55=uimenu(menu5,'label','Move &Camera');
menu56=uimenu(menu5,'label','Camera &Motion','separator','on');
menu561=uimenu(menu56,'label','&Orbit Carema');
menu562=uimenu(menu56,'label','&Orbit Scene &Light');
menu563=uimenu(menu56,'label','&Pan-Turn/Tilt');
menu564=uimenu(menu56,'label','Move-&Horizontally/Vertically');
menu565=uimenu(menu56,'label','Move-&Forward/Back');
menu566=uimenu(menu56,'label','&Zoom');
menu567=uimenu(menu56,'label','&Roll');
menu568=uimenu(menu56,'label','&Walk');
menu57=uimenu(menu5,'label','Camera A&xis');
menu571=uimenu(menu57,'label','&X Principal Axis','enable','off');
menu572=uimenu(menu57,'label','&Y Principal Axis','enable','off');
menu573=uimenu(menu57,'label','&Z Principal Axis','enable','off');
menu574=uimenu(menu57,'label','&No Principal Axis','enable','off');
menu58=uimenu(menu5,'label','Camera Re&set');
menu581=uimenu(menu58,'label',['Reset &Carema ',char(38),' Scene Light']);
menu582=uimenu(menu58,'label','Reset &Target Point');
menu583=uimenu(menu58,'label','Reset &Scene Light');
menu59=uimenu(menu5,'label','Camera A&xis');
menu510=uimenu(menu5,'label','&Basic Fitting','separator','on');
menu511=uimenu(menu5,'label','&Data Statistics');
menu6 =uimenu(gcf,'label','&Window');
menu61=uimenu(menu6,'label','&0 MATLAB Command Window');
menu7 =uimenu(gcf,'label','&Help');
menu71=uimenu(menu7,'label','&Graphics help');
menu72=uimenu(menu7,'label','&Formatting Graphs','separator','on');
menu73=uimenu(menu7,'label','&Printing and Exporting');
menu74=uimenu(menu7,'label','&Camera Toolbar');
menu75=uimenu(menu7,'label','&Demos','separator','on');
menu76=uimenu(menu7,'label','&Abort MATLAB...','separator','on');
--
╔═══════════════════╗
║★★★★★友谊第一 比赛第二★★★★★║
╚═══════════════════╝
※ 来源:·哈工大紫丁香 http://bbs.hit.edu.cn·[FROM: 202.118.229.*]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:4.127毫秒