M
Matt Budd
Hello all..
I am writing a fairly simply C# app that consists of a main form and then a
modal dialog. The glitch is that when I click my button on the main form, I
want to minimize the main form before I show the modal dialog. I've tried
the following code:
//-----------------------------------------
FormWindowState leOriginalWindowState = this.WindowState;
frmPreview loPreviewForm = new frmPreview();
this.WindowState = FormWindowState.Minimized;
loPreviewForm.ShowDialog();
this.WindowState = leOriginalWindowState;
//-----------------------------------------
This does launch the dialog, but because I minimized the main form, the
application loses focus in the taskbar. Even though the dialog itself isn't
minimized, the OS focus changes to the next open application (like if I
would've done an Alt+Tab), and the dialog then appears behind the other
application window.
I can get it to sort of work if I do a this.Hide() and this.Show() instead
of the minimize and restore, but I don't really want to comprimise that
functionality...any ideas?
Thanks for any info,
Matt
I am writing a fairly simply C# app that consists of a main form and then a
modal dialog. The glitch is that when I click my button on the main form, I
want to minimize the main form before I show the modal dialog. I've tried
the following code:
//-----------------------------------------
FormWindowState leOriginalWindowState = this.WindowState;
frmPreview loPreviewForm = new frmPreview();
this.WindowState = FormWindowState.Minimized;
loPreviewForm.ShowDialog();
this.WindowState = leOriginalWindowState;
//-----------------------------------------
This does launch the dialog, but because I minimized the main form, the
application loses focus in the taskbar. Even though the dialog itself isn't
minimized, the OS focus changes to the next open application (like if I
would've done an Alt+Tab), and the dialog then appears behind the other
application window.
I can get it to sort of work if I do a this.Hide() and this.Show() instead
of the minimize and restore, but I don't really want to comprimise that
functionality...any ideas?
Thanks for any info,
Matt