📄 subject_29967.htm
字号:
<p>
序号:29967 发表者:硬撅撅 发表日期:2003-02-19 09:16:01
<br>主题:基于对话框的程序如何结束对话框并返回?
<br>内容: 一般在应用程序的InitInstance函数中都有如下的语句: <BR>int nResponse = dlg.DoModal(); <BR>if (nResponse == IDOK) <BR>{ <BR>// TODO: Place code here to handle when the dialog is <BR>// dismissed with OK <BR>} <BR>else if (nResponse == IDCANCEL) <BR>{ <BR>// TODO: Place code here to handle when the dialog is <BR>// dismissed with Cancel <BR>} <BR>当该对话框被打开后,除了点击对话中默认的“确认”和“取消”按钮,我们如何定制自己的“关闭对话框并返回值给nResponse”的按钮? <BR><BR>为什么确认和取消按钮的ID号必须为IDOK和IDCANCEL?它是怎样的一种机制? <BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:无非 回复日期:2003-02-19 09:47:17
<br>内容:确认和取消按钮的ID不是必须为IDOK和IDCANCEL,只是默认情况下是这样。而在这里传给nResponse的IDOK也不是对话框里的按钮的ID,而是对话框返回的一个值。<BR>你可以在对话框类中,重载OnOk()和OnCancel()。如果愿意,你在OnOk()里传回给nResponse一个IDCANCEL都行。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -