o 哦,多谢!多谢!那刚我个忙吧,帮我解决这个问题了,好好的谢你,我的QQ:46924867!

解决方案 »

  1.   

    源程序在这里,大家帮忙看下哦!/// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new FormMain());
    }
    const int MaxLenght=2000000; private void FormMain_Load(object sender, System.EventArgs e)
    {
    textBoxedit.MaxLength=MaxLenght;
    textBoxedit.Multiline=true;
    textBoxedit.Dock=DockStyle.Fill;
    textBoxedit.Text="我的文本编辑器";
    textBoxedit.ScrollBars=ScrollBars.Both;
    textBoxedit.WordWrap=false;
    textBoxedit.ReadOnly=false;
    textBoxedit.AcceptsReturn=true;
    textBoxedit.AcceptsTab=true;
    } private void textBoxEdit_TextChanged(object sender, System.EventArgs e)
    {

    } private void Undo_Click(object sender, System.EventArgs e)
    {
    if (textBoxedit.CanUndo == true)
    textBoxedit.Undo();
    textBoxedit.ClearUndo();
    } private void menuItemexit_Click(object sender, System.EventArgs e)
    {
    this.Close();
    } private void Cut_Click(object sender, System.EventArgs e)
    {
    if (textBoxedit.SelectedText != "")
    textBoxedit.Cut();
    } private void Copy_Click(object sender, System.EventArgs e)
    {
    if (textBoxedit.SelectionLength>0)
    textBoxedit.Copy();
    } private void Paste_Click(object sender, System.EventArgs e)
    {
    if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text)==true)
    {if(textBoxedit.SelectionLength>0)
     { DialogResult result; result = MessageBox.Show("你想覆盖所选择的文本吗?","覆盖确认",MessageBoxButtons.YesNo);
     if(result==DialogResult.No) {textBoxedit.SelectionStart=textBoxedit.SelectionStart + textBoxedit.SelectionLength;}}
    textBoxedit.Paste();
    }
    } private void Del_Click(object sender, System.EventArgs e)
    {
         textBoxedit.SelectedText.Remove(1,textBoxedit.SelectionLength);
    } private void Selall_Click(object sender, System.EventArgs e)
    {
    textBoxedit.SelectAll();
    }
    }