chess-board/ChessPanel/MainForm.cs
2017-02-27 15:15:50 +01:00

53 lines
1.3 KiB
C#

using System;
using System.Windows.Forms;
namespace Chess
{
public partial class MainForm : Form
{
bool Fullscreen = false;
bool fullscreen
{
get { return Fullscreen; }
set { Fullscreen = value; RefreshFullScreen(); }
}
public MainForm()
{
InitializeComponent();
}
private void RefreshFullScreen()
{
this.SuspendLayout();
if (fullscreen)
{
this.WindowState = FormWindowState.Normal;
this.FormBorderStyle = FormBorderStyle.None;
this.Bounds = Screen.PrimaryScreen.Bounds;
}
else
{
this.FormBorderStyle = FormBorderStyle.Sizable;
this.WindowState = FormWindowState.Maximized;
}
this.ResumeLayout(true);
}
private void MainForm_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F11)
fullscreen = !fullscreen;
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
chessGame.FormClosing(sender, e);
}
private void MainForm_Load(object sender, EventArgs e)
{
fullscreen = true;
}
}
}