![]() |
#2
leki2007-06-22 15:39
|
screen=get(0,'ScreenSize');
W=screen(3);H=screen(4);
figure('Color',[1,1,1],'Position',[0.2*H,0.2*H,0.6*W,0.4*H],'Name','图形演示系统','NumberTitle','off','MenuBar','none');
%定义Plot菜单项
hplot=uimenu(gcf,'Label','&Plot')
uimenu(hplot,'Label','Sine Wave','Call',['t=-pi:pi/20:pi;','y=sin(t);','plot(t,y);',...
'set(hgon,"Enable","on");','set(hgoff,"Enable","on");',...
'set(hbon,"Enable","on");','set(hboff,"Enable","on");']);
uimenu(hplot,'Label','Cosine Wave','Call',['t=-pi:pi/20:pi;','y=cos(t);','plot(t,y);',...
'set(hgon,"Enable","on");','set(hgoff,"Enable","on");',...
'set(hbon,"Enable","on");','set(hboff,"Enable","on");']);
%定义Option菜单项
hoption=uimenu(gcf,'Label','&Option');
hgon=uimenu(hoption,'Label','&Grid on','Call','grid on','Enable','off');
hgoff=uimenu(hoption,'Label','&Grid off','Call','grid off','Enable','off');
hbon=uimenu(hoption,'Label','&Box on','Separator','on','Call','box on','Enable','off');
hboff=uimenu(hoption,'Label','&Box off','Call','box off','Enable','off');
hfigcolor=uimenu(hoption,'Label','&Fig Color','Separator','on');
uimenu(hfigcolor,'Label','&Red','Accelerator','r','Call','set(gcf,"Color","r");');
uimenu(hfigcolor,'Label','&Green','Accelerator','g','Call','set(gcf,"Color","g");');
%定义Quit菜单项
uimenu(gcf,'Label','&Quit','Call','close(gcf)');
PS: 其中划线部分为我猜测的可能出错的地方
[此贴子已经被作者于2007-6-22 14:52:17编辑过]