From 6c7c199eb95b6f2224297688905dd72e5fe215c4 Mon Sep 17 00:00:00 2001 From: Bartek Poniatyszyn Date: Tue, 4 Apr 2017 00:51:48 +0200 Subject: [PATCH] Add test color change dialog --- AntsAlgorithm/Views/MainForm.Designer.cs | 124 ++++++++++++++++------- AntsAlgorithm/Views/MainForm.cs | 13 +++ AntsAlgorithm/Views/MainForm.resx | 3 + 3 files changed, 102 insertions(+), 38 deletions(-) diff --git a/AntsAlgorithm/Views/MainForm.Designer.cs b/AntsAlgorithm/Views/MainForm.Designer.cs index 8924b41..b45eaef 100644 --- a/AntsAlgorithm/Views/MainForm.Designer.cs +++ b/AntsAlgorithm/Views/MainForm.Designer.cs @@ -47,12 +47,16 @@ private void InitializeComponent() this.radioButtonSelect = new System.Windows.Forms.RadioButton(); this.Editor = new System.Windows.Forms.TabPage(); this.Settings = new System.Windows.Forms.TabPage(); - this.statusStrip1 = new System.Windows.Forms.StatusStrip(); - this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.groupBoxSettingsLanguage = new System.Windows.Forms.GroupBox(); - this.radioButtonPolish = new System.Windows.Forms.RadioButton(); - this.radioButtonEnglish = new System.Windows.Forms.RadioButton(); this.radioButtonDeutch = new System.Windows.Forms.RadioButton(); + this.radioButtonEnglish = new System.Windows.Forms.RadioButton(); + this.radioButtonPolish = new System.Windows.Forms.RadioButton(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.groupBoxTheme = new System.Windows.Forms.GroupBox(); + this.colorDialogTheme = new System.Windows.Forms.ColorDialog(); + this.label1 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); this.MainTabControl.SuspendLayout(); this.Main.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); @@ -60,8 +64,9 @@ private void InitializeComponent() this.groupBoxActions.SuspendLayout(); this.groupBoxSelectMode.SuspendLayout(); this.Settings.SuspendLayout(); - this.statusStrip1.SuspendLayout(); this.groupBoxSettingsLanguage.SuspendLayout(); + this.statusStrip1.SuspendLayout(); + this.groupBoxTheme.SuspendLayout(); this.SuspendLayout(); // // MainTabControl @@ -266,6 +271,7 @@ private void InitializeComponent() // // Settings // + this.Settings.Controls.Add(this.groupBoxTheme); this.Settings.Controls.Add(this.groupBoxSettingsLanguage); this.Settings.Location = new System.Drawing.Point(4, 22); this.Settings.Name = "Settings"; @@ -275,21 +281,6 @@ private void InitializeComponent() this.Settings.Text = "Settings"; this.Settings.UseVisualStyleBackColor = true; // - // statusStrip1 - // - this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripStatusLabel}); - this.statusStrip1.Location = new System.Drawing.Point(0, 389); - this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Size = new System.Drawing.Size(734, 22); - this.statusStrip1.TabIndex = 1; - this.statusStrip1.Text = "statusStrip1"; - // - // toolStripStatusLabel - // - this.toolStripStatusLabel.Name = "toolStripStatusLabel"; - this.toolStripStatusLabel.Size = new System.Drawing.Size(0, 17); - // // groupBoxSettingsLanguage // this.groupBoxSettingsLanguage.Controls.Add(this.radioButtonDeutch); @@ -302,15 +293,15 @@ private void InitializeComponent() this.groupBoxSettingsLanguage.TabStop = false; this.groupBoxSettingsLanguage.Text = "Language"; // - // radioButtonPolish + // radioButtonDeutch // - this.radioButtonPolish.AutoSize = true; - this.radioButtonPolish.Location = new System.Drawing.Point(7, 20); - this.radioButtonPolish.Name = "radioButtonPolish"; - this.radioButtonPolish.Size = new System.Drawing.Size(53, 17); - this.radioButtonPolish.TabIndex = 0; - this.radioButtonPolish.Text = "Polish"; - this.radioButtonPolish.UseVisualStyleBackColor = true; + this.radioButtonDeutch.AutoSize = true; + this.radioButtonDeutch.Location = new System.Drawing.Point(7, 68); + this.radioButtonDeutch.Name = "radioButtonDeutch"; + this.radioButtonDeutch.Size = new System.Drawing.Size(60, 17); + this.radioButtonDeutch.TabIndex = 2; + this.radioButtonDeutch.Text = "Deutch"; + this.radioButtonDeutch.UseVisualStyleBackColor = true; // // radioButtonEnglish // @@ -324,15 +315,66 @@ private void InitializeComponent() this.radioButtonEnglish.Text = "English"; this.radioButtonEnglish.UseVisualStyleBackColor = true; // - // radioButtonDeutch + // radioButtonPolish // - this.radioButtonDeutch.AutoSize = true; - this.radioButtonDeutch.Location = new System.Drawing.Point(7, 68); - this.radioButtonDeutch.Name = "radioButtonDeutch"; - this.radioButtonDeutch.Size = new System.Drawing.Size(60, 17); - this.radioButtonDeutch.TabIndex = 2; - this.radioButtonDeutch.Text = "Deutch"; - this.radioButtonDeutch.UseVisualStyleBackColor = true; + this.radioButtonPolish.AutoSize = true; + this.radioButtonPolish.Location = new System.Drawing.Point(7, 20); + this.radioButtonPolish.Name = "radioButtonPolish"; + this.radioButtonPolish.Size = new System.Drawing.Size(53, 17); + this.radioButtonPolish.TabIndex = 0; + this.radioButtonPolish.Text = "Polish"; + this.radioButtonPolish.UseVisualStyleBackColor = true; + // + // statusStrip1 + // + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel}); + this.statusStrip1.Location = new System.Drawing.Point(0, 389); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(734, 22); + this.statusStrip1.TabIndex = 1; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStripStatusLabel + // + this.toolStripStatusLabel.Name = "toolStripStatusLabel"; + this.toolStripStatusLabel.Size = new System.Drawing.Size(0, 17); + // + // groupBoxTheme + // + this.groupBoxTheme.Controls.Add(this.button1); + this.groupBoxTheme.Controls.Add(this.label1); + this.groupBoxTheme.Location = new System.Drawing.Point(7, 114); + this.groupBoxTheme.Name = "groupBoxTheme"; + this.groupBoxTheme.Size = new System.Drawing.Size(200, 100); + this.groupBoxTheme.TabIndex = 1; + this.groupBoxTheme.TabStop = false; + this.groupBoxTheme.Text = "Theme"; + // + // colorDialogTheme + // + this.colorDialogTheme.AnyColor = true; + this.colorDialogTheme.FullOpen = true; + this.colorDialogTheme.ShowHelp = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(7, 20); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(35, 13); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(48, 15); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 1; + this.button1.Text = "button1"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); // // MainForm // @@ -352,10 +394,12 @@ private void InitializeComponent() this.groupBoxSelectMode.ResumeLayout(false); this.groupBoxSelectMode.PerformLayout(); this.Settings.ResumeLayout(false); - this.statusStrip1.ResumeLayout(false); - this.statusStrip1.PerformLayout(); this.groupBoxSettingsLanguage.ResumeLayout(false); this.groupBoxSettingsLanguage.PerformLayout(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + this.groupBoxTheme.ResumeLayout(false); + this.groupBoxTheme.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -388,6 +432,10 @@ private void InitializeComponent() private System.Windows.Forms.RadioButton radioButtonDeutch; private System.Windows.Forms.RadioButton radioButtonEnglish; private System.Windows.Forms.RadioButton radioButtonPolish; + private System.Windows.Forms.GroupBox groupBoxTheme; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ColorDialog colorDialogTheme; } } diff --git a/AntsAlgorithm/Views/MainForm.cs b/AntsAlgorithm/Views/MainForm.cs index c9250af..5ae0b66 100644 --- a/AntsAlgorithm/Views/MainForm.cs +++ b/AntsAlgorithm/Views/MainForm.cs @@ -308,5 +308,18 @@ private void DrawPath(Point a, Point b) } #endregion + + private void button1_Click(object sender, EventArgs e) + { + colorDialogTheme = new ColorDialog(); + // Keeps the user from selecting a custom color. + colorDialogTheme.AllowFullOpen = false; + // Allows the user to get help. (The default is false.) + colorDialogTheme.ShowHelp = true; + + // Update the text box color if the user clicks OK + if (colorDialogTheme.ShowDialog() == DialogResult.OK) + label1.ForeColor = colorDialogTheme.Color; + } } } diff --git a/AntsAlgorithm/Views/MainForm.resx b/AntsAlgorithm/Views/MainForm.resx index 174ebc7..c698276 100644 --- a/AntsAlgorithm/Views/MainForm.resx +++ b/AntsAlgorithm/Views/MainForm.resx @@ -120,4 +120,7 @@ 17, 17 + + 133, 17 + \ No newline at end of file