Copy/Paste

Did Copy/Paste for Calculator
BUT paste is not doing too well at filtering out the letters.
This commit is contained in:
jtsshieh 2017-07-14 18:20:57 -04:00
parent 606a3275a1
commit 14d1d663f5
2 changed files with 32 additions and 2 deletions

View file

@ -119,15 +119,17 @@ private void InitializeComponent()
//
this.PasteCtrlVToolStripMenuItem1.BackColor = System.Drawing.Color.Silver;
this.PasteCtrlVToolStripMenuItem1.Name = "PasteCtrlVToolStripMenuItem1";
this.PasteCtrlVToolStripMenuItem1.Size = new System.Drawing.Size(150, 22);
this.PasteCtrlVToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
this.PasteCtrlVToolStripMenuItem1.Text = "Paste Ctrl+V";
this.PasteCtrlVToolStripMenuItem1.Click += new System.EventHandler(this.PasteCtrlVToolStripMenuItem1_Click);
//
// CopyCtrlCToolStripMenuItem1
//
this.CopyCtrlCToolStripMenuItem1.BackColor = System.Drawing.Color.Silver;
this.CopyCtrlCToolStripMenuItem1.Name = "CopyCtrlCToolStripMenuItem1";
this.CopyCtrlCToolStripMenuItem1.Size = new System.Drawing.Size(150, 22);
this.CopyCtrlCToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
this.CopyCtrlCToolStripMenuItem1.Text = "Copy Ctrl+C";
this.CopyCtrlCToolStripMenuItem1.Click += new System.EventHandler(this.CopyCtrlCToolStripMenuItem1_Click);
//
// EditToolStripMenuItem1
//
@ -388,6 +390,7 @@ private void InitializeComponent()
this.Button15.TabIndex = 72;
this.Button15.Text = "+/-";
this.Button15.UseVisualStyleBackColor = true;
this.Button15.Click += new System.EventHandler(this.Button15_Click);
//
// Button17
//

View file

@ -144,5 +144,32 @@ private void AboutCalculatorToolStripMenuItem_Click(object sender, EventArgs e)
WindowManager wm = new WindowManager();
wm.StartAboutBox95("Calculator", "Microsoft Calculator", Properties.Resources.WinClassicCalc);
}
private void Button15_Click(object sender, EventArgs e)
{
}
private void CopyCtrlCToolStripMenuItem1_Click(object sender, EventArgs e)
{
txtNumbers.Copy();
}
private void PasteCtrlVToolStripMenuItem1_Click(object sender, EventArgs e)
{
string pasteText = Clipboard.GetText();
string strippedText = "";
for (int i = 0; i < pasteText.Length; i++)
{
if (char.IsDigit(pasteText[i]))
strippedText += pasteText[i].ToString();
MessageBox.Show("Test");
}
if (strippedText!=pasteText)
{
txtNumbers.Text = pasteText;
}
}
}
}