From 569ae5cbe1ad8ae1c8345ad99392253f97d3d239 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 9 Dec 2018 16:08:07 +0200 Subject: [PATCH] Changed eye icon behavior --- Crypto Notepad/ChangeKeyForm.Designer.cs | 4 ++-- Crypto Notepad/ChangeKeyForm.cs | 27 ++++++++++-------------- Crypto Notepad/Form2.Designer.cs | 3 ++- Crypto Notepad/Form2.cs | 8 +++---- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/Crypto Notepad/ChangeKeyForm.Designer.cs b/Crypto Notepad/ChangeKeyForm.Designer.cs index a4af853..86a1683 100644 --- a/Crypto Notepad/ChangeKeyForm.Designer.cs +++ b/Crypto Notepad/ChangeKeyForm.Designer.cs @@ -121,7 +121,7 @@ private void InitializeComponent() // this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pictureBox2.Cursor = System.Windows.Forms.Cursors.Hand; - this.pictureBox2.Image = global::Crypto_Notepad.Properties.Resources.eye; + this.pictureBox2.Image = global::Crypto_Notepad.Properties.Resources.eye_half; this.pictureBox2.Location = new System.Drawing.Point(219, 43); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(32, 20); @@ -134,7 +134,7 @@ private void InitializeComponent() // this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand; - this.pictureBox1.Image = global::Crypto_Notepad.Properties.Resources.eye; + this.pictureBox1.Image = global::Crypto_Notepad.Properties.Resources.eye_half; this.pictureBox1.Location = new System.Drawing.Point(219, 9); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(32, 20); diff --git a/Crypto Notepad/ChangeKeyForm.cs b/Crypto Notepad/ChangeKeyForm.cs index 0fa250a..8870d4a 100644 --- a/Crypto Notepad/ChangeKeyForm.cs +++ b/Crypto Notepad/ChangeKeyForm.cs @@ -51,41 +51,36 @@ private async void button1_Click(object sender, EventArgs e) private void pictureBox1_Click(object sender, EventArgs e) { - if (textBox1.UseSystemPasswordChar == true) + if (textBox1.UseSystemPasswordChar) { textBox1.UseSystemPasswordChar = false; - pictureBox1.Image = Properties.Resources.eye_half; + pictureBox1.Image = Properties.Resources.eye; return; } - if (textBox1.UseSystemPasswordChar == false) + if (!textBox1.UseSystemPasswordChar) { textBox1.UseSystemPasswordChar = true; - pictureBox1.Image = Properties.Resources.eye; + pictureBox1.Image = Properties.Resources.eye_half; return; } } private void pictureBox2_Click(object sender, EventArgs e) { - if (textBox2.UseSystemPasswordChar == true) + if (textBox2.UseSystemPasswordChar) { textBox2.UseSystemPasswordChar = false; - pictureBox2.Image = Properties.Resources.eye_half; - return; - } - - if (textBox2.UseSystemPasswordChar == false) - { - textBox2.UseSystemPasswordChar = true; pictureBox2.Image = Properties.Resources.eye; return; } - } - - private void ChangeKeyForm_Load(object sender, EventArgs e) - { + if (!textBox2.UseSystemPasswordChar) + { + textBox2.UseSystemPasswordChar = true; + pictureBox2.Image = Properties.Resources.eye_half; + return; + } } private void textBox1_TextChanged(object sender, EventArgs e) diff --git a/Crypto Notepad/Form2.Designer.cs b/Crypto Notepad/Form2.Designer.cs index 4aa9435..f391622 100644 --- a/Crypto Notepad/Form2.Designer.cs +++ b/Crypto Notepad/Form2.Designer.cs @@ -66,7 +66,8 @@ private void InitializeComponent() // this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand; - this.pictureBox1.Image = global::Crypto_Notepad.Properties.Resources.eye; + this.pictureBox1.Image = global::Crypto_Notepad.Properties.Resources.eye_half; + this.pictureBox1.InitialImage = global::Crypto_Notepad.Properties.Resources.eye_half; this.pictureBox1.Location = new System.Drawing.Point(163, 39); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(18, 20); diff --git a/Crypto Notepad/Form2.cs b/Crypto Notepad/Form2.cs index bd36d6a..b2637c5 100644 --- a/Crypto Notepad/Form2.cs +++ b/Crypto Notepad/Form2.cs @@ -39,17 +39,17 @@ private void textBox1_KeyDown(object sender, KeyEventArgs e) private void pictureBox1_Click(object sender, EventArgs e) { - if (textBox1.UseSystemPasswordChar == true) + if (textBox1.UseSystemPasswordChar) { textBox1.UseSystemPasswordChar = false; - pictureBox1.Image = Properties.Resources.eye_half; + pictureBox1.Image = Properties.Resources.eye; return; } - if (textBox1.UseSystemPasswordChar == false) + if (!textBox1.UseSystemPasswordChar) { textBox1.UseSystemPasswordChar = true; - pictureBox1.Image = Properties.Resources.eye; + pictureBox1.Image = Properties.Resources.eye_half; return; } }