private void Form1_Load(object sender, EventArgs e)
{// RichTextBox
ContextMenuStrip MenuStrip1 = new System.Windows.Forms.ContextMenuStrip();
MenuStrip1.Name = "menuStrip1";
MenuStrip1.Text = "menuStrip1";
ToolStripMenuItem MyItem1 = new ToolStripMenuItem();
MyItem1.Text = " (&A)";
ToolStripMenuItem MyItem2 = new ToolStripMenuItem();
MyItem2.Text = " (&X)";
ToolStripMenuItem MyItem3 = new ToolStripMenuItem();
MyItem3.Text = " (&C)";
ToolStripMenuItem MyItem4 = new ToolStripMenuItem();
MyItem4.Text = " (&P)";
MenuStrip1.Items.Add(MyItem1);
MenuStrip1.Items.Add(MyItem2);
MenuStrip1.Items.Add(MyItem3);
MenuStrip1.Items.Add(MyItem4);
this.richTextBox1.ContextMenuStrip = MenuStrip1;
MyItem1.Click += new System.EventHandler(this.MyItem1_Click);
MyItem2.Click += new System.EventHandler(this.MyItem2_Click);
MyItem3.Click += new System.EventHandler(this.MyItem3_Click);
MyItem4.Click += new System.EventHandler(this.MyItem4_Click);
}
private void MyItem1_Click(object sender, EventArgs e)
{//
this.richTextBox1.SelectAll();
}
private void MyItem2_Click(object sender, EventArgs e)
{//
this.richTextBox1.Cut();
}
private void MyItem3_Click(object sender, EventArgs e)
{//
this.richTextBox1.Copy();
}
private void MyItem4_Click(object sender, EventArgs e)
{//
this.richTextBox1.Paste();
}