WinForm state

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)

{

}
 
I

Ignacio Machin \( .NET/ C# MVP \)

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
 

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

Top