Created
April 3, 2018 16:50
-
-
Save Owez/f1a3871608971110ab570c917ca908ef to your computer and use it in GitHub Desktop.
C# Maximize button | full code (will maximized if it is normal and go back to normal if pressed again)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Maximise button (when clicked) | |
private void buttonMaximise_Click(object sender, EventArgs e) | |
{ | |
if (this.WindowState == System.Windows.Forms.FormWindowState.Normal) // if the forms state is normal (not maximised or minimised) then.. | |
{ | |
this.WindowState = FormWindowState.Maximized; // Tells windows this application should be maximised | |
} | |
else if (this.WindowState == System.Windows.Forms.FormWindowState.Maximized) // if the forms state is maximised then.. | |
{ | |
this.WindowState = FormWindowState.Normal; // Tells windows this application should be in the normal state (not maximised or minimised) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works perfectly - thanks for sharing