WinForm state

  • Thread starter Thread starter Alan T
  • Start date Start date
A

Alan T

Sometimes I will minimize my main form on the task bar and right click to
close the application.
How do I know if the previous form state is minimized when I start my
application next time?

private void MainForm_FormClosed(object sender, FormClosedEventArgs e)

{

Settings.Default.AdminFormWidth = this.Width;

Settings.Default.AdminFormHeight = this.Height;

Settings.Default.AdminFormLeft = this.Left;

Settings.Default.AdminFormTop = this.Top;

Settings.Default.Save();

}



private void MainForm_Load(object sender, EventArgs e)

{

}
 
Hi,


Do you want to run only one instance?

There are several ways of doing it.

You could also use the Process.GetProcesses() to iterate in the processes
running

You could then send a message to the other instance of your process that
return the status of the main window
 
Back
Top