From 09a67c3ba524a864385723f77bacd28204d1a436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:46:06 +0300 Subject: [PATCH] #3: Implement the actual closing when pressing Exit in the menu --- Viewer/FormMain.Designer.cs | 28 +++++++++++++++------------- Viewer/FormMain.cs | 5 +++++ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Viewer/FormMain.Designer.cs b/Viewer/FormMain.Designer.cs index 589eb8f..f121a7c 100644 --- a/Viewer/FormMain.Designer.cs +++ b/Viewer/FormMain.Designer.cs @@ -57,6 +57,7 @@ private void InitializeComponent() this.simCanvas = new System.Windows.Forms.PictureBox(); this.tabSimulation = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); + this.btRand = new System.Windows.Forms.Button(); this.lblMaxAgentsInfo = new System.Windows.Forms.Label(); this.inputWorld = new System.Windows.Forms.ComboBox(); this.label10 = new System.Windows.Forms.Label(); @@ -100,7 +101,6 @@ private void InitializeComponent() this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.colorPickerDlg = new System.Windows.Forms.ColorDialog(); - this.btRand = new System.Windows.Forms.Button(); this.toolTipGroupSize = new System.Windows.Forms.ToolTip(this.components); this.menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); @@ -179,6 +179,7 @@ private void InitializeComponent() this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Size = new System.Drawing.Size(187, 22); this.exitToolStripMenuItem.Text = "Exit"; + this.exitToolStripMenuItem.Click += new System.EventHandler(this.OnClickExit); // // viewToolStripMenuItem // @@ -378,15 +379,25 @@ private void InitializeComponent() this.tabPage1.Text = "Base Parameters"; this.tabPage1.UseVisualStyleBackColor = true; // + // btRand + // + this.btRand.Location = new System.Drawing.Point(212, 37); + this.btRand.Name = "btRand"; + this.btRand.Size = new System.Drawing.Size(22, 22); + this.btRand.TabIndex = 43; + this.btRand.Text = "R"; + this.btRand.UseVisualStyleBackColor = true; + this.btRand.Click += new System.EventHandler(this.OnRandSeedClick); + // // lblMaxAgentsInfo // this.lblMaxAgentsInfo.AutoSize = true; this.lblMaxAgentsInfo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); this.lblMaxAgentsInfo.Location = new System.Drawing.Point(262, 66); this.lblMaxAgentsInfo.Name = "lblMaxAgentsInfo"; - this.lblMaxAgentsInfo.Size = new System.Drawing.Size(150, 13); + this.lblMaxAgentsInfo.Size = new System.Drawing.Size(91, 13); this.lblMaxAgentsInfo.TabIndex = 42; - this.lblMaxAgentsInfo.Text = "Recommended: 6000 or more."; + this.lblMaxAgentsInfo.Text = ""; this.lblMaxAgentsInfo.Visible = false; // // inputWorld @@ -876,16 +887,6 @@ private void InitializeComponent() // this.colorPickerDlg.AnyColor = true; // - // btRand - // - this.btRand.Location = new System.Drawing.Point(212, 37); - this.btRand.Name = "btRand"; - this.btRand.Size = new System.Drawing.Size(22, 22); - this.btRand.TabIndex = 43; - this.btRand.Text = "R"; - this.btRand.UseVisualStyleBackColor = true; - this.btRand.Click += new System.EventHandler(this.OnRandSeedClick); - // // toolTipGroupSize // this.toolTipGroupSize.ToolTipTitle = "Hello World"; @@ -897,6 +898,7 @@ private void InitializeComponent() this.ClientSize = new System.Drawing.Size(856, 717); this.Controls.Add(this.splitContainer1); this.Controls.Add(this.menuStrip1); + this.DoubleBuffered = true; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; this.MainMenuStrip = this.menuStrip1; diff --git a/Viewer/FormMain.cs b/Viewer/FormMain.cs index 9c3716c..9e79483 100644 --- a/Viewer/FormMain.cs +++ b/Viewer/FormMain.cs @@ -1049,5 +1049,10 @@ private void OnRandSeedClick(object sender, EventArgs e) { inputRandomSeed.Value = prng.Next(); } + + private void OnClickExit(object sender, EventArgs e) + { + Close(); + } } }