can i unminimize in code

  • Thread starter Thread starter Rachel Suddeth
  • Start date Start date
R

Rachel Suddeth

Hi,

I have a singleton calculator form, that can be displayed (non-modal) from
any number of places in my ap (either by button clicks or special
keypresses.) We did it this way because it has some special features that
involve saving state, and it seemed easiest to just keep the thing around
since we'll never want more than one open at a time. The code to display it
currently looks like this:

public static void ShowPopup()
{
if(PopupCalculator != null)
{
PopupCalculator.Activate();
}
else
{
PopupCalculator = new SpecialCalculator();
PopupCalculator.Show();
}
}

The problem with this is that if the Calculor form is minimized, we'd like
the ShowPopup() to unminimize it. Right now the call to Activate() is just
highlighting the taskbar icon. Anyone know how to force it to unminimize in
code?

Thanks,
Rachel
 
Hi,

I have a singleton calculator form, that can be displayed
(non-modal) from any number of places in my ap (either by button
clicks or special keypresses.) We did it this way because it has
some special features that involve saving state, and it seemed
easiest to just keep the thing around since we'll never want
more than one open at a time. The code to display it currently
looks like this:

public static void ShowPopup()
{
if(PopupCalculator != null)
{
PopupCalculator.Activate();
}
else
{
PopupCalculator = new SpecialCalculator();
PopupCalculator.Show();
}
}

The problem with this is that if the Calculor form is minimized,
we'd like the ShowPopup() to unminimize it. Right now the call
to Activate() is just highlighting the taskbar icon. Anyone know
how to force it to unminimize in code?

Rachel,

Set the window state to "Normal" before activating it:

PopupCalculator.WindowState = FormWindowState.Normal;
PopupCalculator.Activate();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top