Fix issue with clipboard < 3 characters

This commit is contained in:
Jed Laundry
2019-08-29 14:50:14 +12:00
parent 5155bc82e0
commit d05734edb7
3 changed files with 6 additions and 17 deletions

View File

@@ -37,16 +37,16 @@
this.textBox1.Location = new System.Drawing.Point(12, 12);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(212, 20);
this.textBox1.Size = new System.Drawing.Size(184, 20);
this.textBox1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(230, 10);
this.button1.Location = new System.Drawing.Point(202, 10);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.Size = new System.Drawing.Size(103, 23);
this.button1.TabIndex = 1;
this.button1.Text = "Type";
this.button1.Text = "Type (2s delay)";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//

View File

@@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TypeClipboard
@@ -97,7 +91,8 @@ namespace TypeClipboard
StringBuilder sb = new StringBuilder();
sb.Append(clipboard.Substring(0, Math.Min(3, clipboard.Length)));
sb.Append(" ... ");
sb.Append(clipboard.Substring(clipboard.Length - 3));
sb.Append(clipboard.Substring(clipboard.Length - Math.Min(clipboard.Length, 3)));
sb.Append(" (" + clipboard.Length.ToString() + " characters)");
textBox1.Text = sb.ToString();
}
else

View File

@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TypeClipboard.Properties;
namespace TypeClipboard
{