summaryrefslogtreecommitdiff
path: root/MainForm.cs
diff options
context:
space:
mode:
authorRamaekers,Aldrik A.N <a.ramaekers@student.fontys.nl>2020-09-16 09:42:04 +0200
committerRamaekers,Aldrik A.N <a.ramaekers@student.fontys.nl>2020-09-16 09:42:04 +0200
commitf6f3bbbc5b7741ad0db3c88a398cfc3943988529 (patch)
treef9f3aca3cc688369607060336b699b8f711eb360 /MainForm.cs
parent5a045404f3c49022abeb75c27dfe6f82d35928f7 (diff)
Diffstat (limited to 'MainForm.cs')
-rw-r--r--MainForm.cs95
1 files changed, 50 insertions, 45 deletions
diff --git a/MainForm.cs b/MainForm.cs
index 724f259..012b47f 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -1,45 +1,50 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Chess
-{
- public partial class MainForm : Form
- {
- private ChessBoard board;
-
- public MainForm()
- {
- InitializeComponent();
- }
-
- private void FitBoardContainerToScreen()
- {
- this.chessBoardBitmap.Location = new Point(0, 0);
- this.chessBoardBitmap.Size = new Size(this.ClientSize.Width, this.ClientSize.Height);
- }
-
- private void MainForm_Load(object sender, EventArgs e)
- {
- FitBoardContainerToScreen();
- this.board = new ChessBoard(this.chessBoardBitmap);
- }
-
- private void MainForm_Resize(object sender, EventArgs e)
- {
- FitBoardContainerToScreen();
- this.board.HandleResize();
- }
-
- private void chessBoardBitmap_MouseClick(object sender, MouseEventArgs e)
- {
- this.board.SelectTile(this.board.MouseToTilePosition(e.X, e.Y));
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Chess
+{
+ public partial class MainForm : Form
+ {
+ private Game game;
+
+ public MainForm()
+ {
+ InitializeComponent();
+ }
+
+ private void FitBoardContainerToScreen()
+ {
+ this.columnHeader1.Width = 30;
+
+ this.chessBoardBitmap.Location = new Point(0, 0);
+ this.chessBoardBitmap.Size = new Size(this.ClientSize.Width - this.gameControlPanel.Width, this.ClientSize.Height);
+ }
+
+ private void MainForm_Load(object sender, EventArgs e)
+ {
+ FitBoardContainerToScreen();
+ this.game = new Game(this);
+ }
+
+ private void MainForm_Resize(object sender, EventArgs e)
+ {
+ var form = sender as MainForm;
+ if (form.WindowState == FormWindowState.Minimized) return;
+
+ FitBoardContainerToScreen();
+ this.game.HandleResize();
+ }
+
+ private void chessBoardBitmap_MouseDown(object sender, MouseEventArgs e)
+ {
+ this.game.HandleClick(e.X, e.Y);
+ }
+ }
+}