53 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			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;
 | |
|         }
 | |
|     }
 | |
| }
 |