Minimize up the chain to the Parent Form
advTHANKSance
private void Form3_Resize(object sender, EventArgs e) {
if (this.WindowState == FormWindowState.Minimized) {
Form frm = this;
while ((frm = frm.Owner) != null)
frm.WindowState = FormWindowState.Minimized;
}
}
The problem is that when you minimize a dialog, the app will no longer have any window left that can receive the focus. Windows needs to find another window to give the focus. None of your app's windows qualify, your app will disappear behind some other app's window.
Dialogs should not be allowed to be minimized, set their MinimizeBox property to False. Take a good look at your UI and ask yourself if you really need a dialog. Simply writing an event handler for the popup window's FormClosed event is usually all you need.I think you see the dilemma faced. If the user has the intentions of minimizing the process to view other items not related to the process or even to get to the desktop, the minimize button is localized to the window being used. Since it is modal, going to the main window's form fails, for focus is in the top most modal dialog.
Note the only way to do this is to use the Show Desktop in the system tray which will minimize all applications and their modal dialogs. Maybe that 's the hint...
Take a good look at your UI and ask yourself if you really need a dialog.
Ahh I wish life was that easy <g>...unfortunately I am architecting/implementing a major data migration between two disparate financial systems. The tool I am writing is to generate a set of data driven rules for the migration and to view the application of the rules against the initial database and its target database.
The first dialog in question holds a non-bounded DataGridView which allows the user to defines a specific migration tasks. In that view, or the row containing the task are fill in data areas and two buttons which bring up an edit box for task specfic SQL and the other button brings up another DataGridView which allows the specification of a column by column basis for data to be changed, by business rules, to be placed into the target migration system.
The alternative is to make the migration user place the migration specifications into a multi-level Xml which would be fraught with in-ease of use and other by hand complications.
Thanks for the response!