Standard Windows Form Actions [Minimize - Maximize - Close]

Asked

Viewed 1,720 times

0

I’m using the visual studio - Windows Forms, and by default the form has the control buttons of the "Minimize" another of "Maximize" and another to Close the form that is a "X", I need to manipulate the actions within them, more specifically I want the program to minimize Hide in form. Does anyone know any way to do that ?

1 answer

2


You can manipulate the Resize event:

    private void Form1_Resize(object sender, EventArgs e)
    {
        if (this.WindowState == FormWindowState.Minimized)
        {
            this.Hide();
        }
        else
        {
            this.Show();
            this.BringToFront();
        }
    }

If you want to set this for all Forms, you need to make a base form that should be inherited by others.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.