diff --git a/Main.cs b/Main.cs index a4d817e..4c9f8e5 100644 --- a/Main.cs +++ b/Main.cs @@ -93,6 +93,7 @@ public Main() bool helpdialog = false; PowerStatus battery = SystemInformation.PowerStatus; Help help = new Help(); + publicbool publicbool = new publicbool(); string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); private void Main_Load(object sender, EventArgs e) @@ -266,14 +267,8 @@ private void t1_Tick(object sender, EventArgs e) if (IsKeyPushedDown(Keys.CapsLock)) { - if (IsKeyLocked(Keys.CapsLock)) + if (!publicbool.visible) { - // nt1.ShowBalloonTip(5, "x1", "capslock enabled", ToolTipIcon.None); - caps.Show(); - } - else - { - //nt1.ShowBalloonTip(5, "x1", "capslock disabled", ToolTipIcon.None); caps.Show(); } } diff --git a/caps.Designer.cs b/caps.Designer.cs index 4b3cb51..3e64a81 100644 --- a/caps.Designer.cs +++ b/caps.Designer.cs @@ -29,36 +29,26 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.panel1 = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); - this.timer1 = new System.Windows.Forms.Timer(this.components); + this.capsindicator = new System.Windows.Forms.Label(); + this.t1 = new System.Windows.Forms.Timer(this.components); this.SuspendLayout(); // - // panel1 + // capsindicator // - this.panel1.BackColor = System.Drawing.Color.Gainsboro; - this.panel1.Location = new System.Drawing.Point(81, 89); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(100, 100); - this.panel1.TabIndex = 0; + this.capsindicator.BackColor = System.Drawing.Color.Transparent; + this.capsindicator.Dock = System.Windows.Forms.DockStyle.Fill; + this.capsindicator.Font = new System.Drawing.Font("Consolas", 25F); + this.capsindicator.ForeColor = System.Drawing.Color.WhiteSmoke; + this.capsindicator.Location = new System.Drawing.Point(0, 0); + this.capsindicator.Name = "capsindicator"; + this.capsindicator.Size = new System.Drawing.Size(263, 279); + this.capsindicator.TabIndex = 1; + this.capsindicator.Text = "a"; + this.capsindicator.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // label1 + // t1 // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Dock = System.Windows.Forms.DockStyle.Fill; - this.label1.Font = new System.Drawing.Font("Consolas", 72F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.Color.WhiteSmoke; - this.label1.Location = new System.Drawing.Point(0, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(263, 279); - this.label1.TabIndex = 1; - this.label1.Text = "a"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.label1.Click += new System.EventHandler(this.label1_Click); - // - // timer1 - // - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + this.t1.Tick += new System.EventHandler(this.timer1_Tick); // // caps // @@ -66,27 +56,24 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(35)))), ((int)(((byte)(35)))), ((int)(((byte)(35))))); this.ClientSize = new System.Drawing.Size(263, 279); - this.Controls.Add(this.label1); - this.Controls.Add(this.panel1); + this.Controls.Add(this.capsindicator); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MaximizeBox = false; this.MaximumSize = new System.Drawing.Size(263, 279); this.MinimizeBox = false; this.MinimumSize = new System.Drawing.Size(263, 279); - this.Name = "caps"; - this.ShowIcon = false; + this.Name = ""; + this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "caps"; + this.Text = ""; this.Load += new System.EventHandler(this.caps_Load); this.ResumeLayout(false); } #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.Label capsindicator; + private System.Windows.Forms.Timer t1; } } \ No newline at end of file diff --git a/caps.cs b/caps.cs index f627787..3f8c67f 100644 --- a/caps.cs +++ b/caps.cs @@ -17,35 +17,35 @@ public caps() InitializeComponent(); } - private void label1_Click(object sender, EventArgs e) - { - - } - + publicbool publicbool = new publicbool(); private void caps_Load(object sender, EventArgs e) - { - this.Opacity = 1; + { + publicbool.visible = true; + Opacity = 1; if (IsKeyLocked(Keys.CapsLock)) { - label1.Text = "A"; + Opacity = 1; + capsindicator.Text = "caps on"; } else { - label1.Text = "a"; + Opacity = 1; + capsindicator.Text = "caps off"; } - timer1.Start(); - timer1.Interval = 1; + t1.Start(); + t1.Interval = 1; } private void timer1_Tick(object sender, EventArgs e) { - if (this.Opacity > 0) + if (Opacity > 0) { - this.Opacity -= 0.01; + Opacity -= 0.01; } else { - this.Close(); - timer1.Stop(); + publicbool.visible = false; + Close(); + t1.Stop(); } } } diff --git a/caps.resx b/caps.resx index 1f666f2..2319691 100644 --- a/caps.resx +++ b/caps.resx @@ -117,7 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 \ No newline at end of file diff --git a/publicbool.cs b/publicbool.cs new file mode 100644 index 0000000..3bf5e9c --- /dev/null +++ b/publicbool.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace x1 +{ + public class publicbool + { + public bool visible = false; + } +} diff --git a/x1.csproj b/x1.csproj index d91745d..3609f0b 100644 --- a/x1.csproj +++ b/x1.csproj @@ -69,6 +69,7 @@ + caps.cs