My ZWindow class is basically just a Form with a custom ZControls property that allows me to add/remove controls. ZWindow handles all of the rendering and keyboard/mouse events for the child controls.
My ZDialog class is just a child control that can be moved/resized and has a titlebar and X (close) button. I have already added functions to Show, Hide, and Close the "dialog", now I am trying to implement a ShowDialog() method that works similar to System.Windows.Forms' ShowDialog. I hope that makes sense.
For example:
ZMessageBox mb = new ZMessageBox(ZWindow parent, string message);
if (mb.ShowDialog() == DialogResult.OK)
{
// Perform action based on the DialogResult returned.
}
For this to work I need to wait until the user clicks a button or closes the dialog before ShowDialog() returns.
This is what I tried but it did not work as well as I had hoped:
public DialogResult ShowDialog()
{
this.Show();
while (this.Visible)
{
Application.DoEvents();
}
return this.DialogResult;
}
Does anyone know a better solution to this problem? Any help would be greatly appreciated. Thanks
Edited by ta0soft, 03 September 2012 - 11:26 AM.






