本文實例講述了C#設置右鍵菜單的方法。分享給大家供大家參考。具體實現方法如下:
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace WindowsApplication1{  public partial class Form4 : Form  {    public Form4()    {      InitializeComponent();    }    private void cutToolStripMenuItem_Click(object sender, EventArgs e)    {      this.textBox1.Cut();    }    private void Form4_Load(object sender, EventArgs e)    {    }    private void copyToolStripMenuItem_Click(object sender, EventArgs e)    {      this.textBox1.Copy();    }    private void pasteToolStripMenuItem_Click(object sender, EventArgs e)    {      this.textBox1.Paste();    }    private void allSelectToolStripMenuItem_Click(object sender, EventArgs e)    {      this.textBox1.SelectAll();    }  }}希望本文所述對大家的C#程序設計有所幫助。
新聞熱點
疑難解答