常用的对话框(三)
1.普通对话框 dialog
h=dialog('PropertyName','PropertyValue'......)
%普通对话框
h=dialog('name','关于...','position',[200 200 200 70]);
uicontrol('parent',h,'style','text','string','你好!','position',[50 40 120 20],'fontsize',12);
uicontrol('parent',h,'style','pushbutton','position',...
[80 10 50 20],'string','确定','callback','delete(gcbf)');
调用格式:
h = errordlgerrordlg函数-->2 axes对象和1 pushbutton对象-->axes子对象有image对象和text对象
%错误对话框
h=errordlg('警告','错误');
ha=get(h,'children');
hu=findall(allchild(h),'style','pushbutton');
set(hu,'string','确定');
ht=findall(ha,'type','text');
set(ht,'fontsize',20,'fontname','隶书');
h = warndlg
h = warndlg(warningstring)
h = warndlg(warningstring,dlgname)
h = warndlg(warningstring,dlgname,createmode)
%警告对话框
h=warndlg('内存不足','警告','modal');
helpdlg
helpdlg('helpstring')
helpdlg('helpstring','dlgname')
h = helpdlg(...)
%帮助对话框
helpdlg('双击对象进入编辑状态','提示');
h = msgbox(Message)
h = msgbox(Message,Title)
h = msgbox(Message,Title,Icon)
h = msgbox(Message,Title,'custom',IconData,IconCMap)
h = msgbox(...,CreateMode)
Icon中有‘error’、‘warn’、‘help’、‘custom’
CreateMode中有 modal non-modal(Default) replace
%信息对话框
msgbox('中日钓鱼岛之争愈演愈烈!','每日新闻','warn');
button = questdlg('qstring')
button = questdlg('qstring','title')
button = questdlg('qstring','title',default)
button = questdlg('qstring','title','str1','str2',default) %两个按钮
button = questdlg('qstring','title','str1','str2','str3',default) %三个按钮
button = questdlg('qstring','title', ..., options)
%提问对话框
questdlg('今天你学习了吗?','问题提示','Yes','No','Yes');