在我的小程序中,需要弹出一些设置参数的对话框,点击确定后,对输入的数值或字符进行处理。
这个用MFC很简单了:
CXXDlg dlg(this);
if(dlg.DoModel() == IDOK)
.............
但是用WinForm我就不知道怎么弄了。研究了一下MSDN,发现其实很简单哦
在FormXX中加入:
this.buttonOk.DialogResult = OK;
this.CancelButton = buttonCancel;
然后调用的时候
if (testDialog.ShowDialog(this) == DialogResult.OK)
.............
即可!