Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make a parent form minimize with its modal child? 1

Status
Not open for further replies.

dalchri

Programmer
Apr 19, 2002
608
US
I perform an extended data operation during which I show a modal status child form with a progress bar and a cancel button. The user is able to minimize this status form so that other things can be done while the process runs.

The problem is that the modal child status form does not minimize to the task bar but rather becomes a small rectangle with the minimize, restore, and close buttons at the lower left hand corner of the screen above the taskbar. Also, the parent form does not and will not minimize but remains in the way of the desktop.

I have these forms setup up as follows:

Code:
class Parent : Form {
void ShowStatus() {
Status frmStatus = new Status();

frmStatus.ShowDialog(this);
}
}
class Status : Form {
Status() {
this.ShowInTaskbar = false;
}
}

What do I need to change so that both the parent and the modal child are hidden when the child is minimized, so that there is only one button on the taskbar for both, and the child does not turn into a small rectangle?
 
Try this:
Form1 form = new Form1();
form.Owner = this;
form.Show();

 
You can set the windows state of the parent form to minimized when the child is minimized. You can't set the parent form property of the child form because you want it to be modal, so you can pass a refrence to the parent in the constructor.
The problem is that the child is being auto closed when the parent is minimized. The idea in a modal form is not to minimize it but finish its work and close it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top