您发布的所有代码实际上都没有显示对话框。您使用ShowDialog
成员函数来执行此操作,但您没有调用该函数。
断章取义,我真的不知道该ShowFormParameter
功能的目的是什么。我想这是一种通过将代码放置在单个函数中来显示参数对话框来模块化代码的尝试。
无论如何,您需要在此函数中编写代码以实际显示您创建的对话框:
public bool ShowFormParameter(IWin32Window parent)
{
// This creates (and automatically disposes of) a new instance of your dialog.
// NOTE: ParameterDialog should be the name of your form class.
using (ParameterDialog dlg = new ParameterDialog())
{
// Call the ShowDialog member function to display the dialog.
if (dlg.ShowDialog(parent) == DialogResult.OK)
{
// If the user clicked OK when closing the dialog, we want to
// save its settings and update the display.
//
// You need to write code here to save the settings.
// It appears the caller (menuItem7_Click) is updating the display.
...
return true;
}
}
return false; // the user canceled the dialog, so don't save anything
}