Reputation: 173
I am working on a small project in c++ and packing it into GUI. The reference source code is enter link description here (Download source code - 61.1 Kb)
I want to prompt a dialog window when choose "menu"-"edit"-"parameter setting". I have already draw a dialog like this
When click "parameter setting"
private void menuItem7_Click(object sender, EventArgs e)
{
if (drawArea.GraphicsList.ShowFormParameter(this))
{
drawArea.SetDirty();
drawArea.Refresh();
}
}
public bool ShowFormParameter(IWin32Window parent)
{
return true;
}
But it does not work, the dialog doesn't show when clicking. How can I realize that?
Upvotes: 0
Views: 1216
Reputation: 244722
None of the code you've posted actually shows a dialog. You use the ShowDialog
member function to do that, but you're not calling that function.
Out of context, I don't really know what the purpose of the ShowFormParameter
function is. I suppose it's an attempt to modularize the code by placing the code to display the parameters dialog in a single function.
At any rate, you need to write code inside this function to actually show the dialog you created:
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
}
Upvotes: 4