zoukankan      html  css  js  c++  java
  • C# 复制 粘贴 剪切 撤销

    //复制
    try
    {
    this.Cursor = Cursors.WaitCursor;
    string strTemp = richTextBoxSendInfo.SelectedText;
    //获取RichTextBox中选中的文字
    if (strTemp.Equals("")) //判断是否为空
    return;
    Clipboard.Clear();//清除原有剪切板中内容
    Clipboard.SetText(strTemp);//将文字添加到剪切板中,还添加Object类型数据
    this.Cursor = Cursors.Default;
    }
    catch (System.Exception ex)
    {
    this.Cursor = Cursors.Default;
    CommonFunc.DisplayException(ex);
    }

    //粘贴
    try
    {
    this.Cursor = Cursors.WaitCursor;
    this.richTextBoxSendInfo.Paste();//粘贴
    this.Cursor = Cursors.Default;
    }
    catch (System.Exception ex)
    {
    this.Cursor = Cursors.Default;
    CommonFunc.DisplayException(ex);
    }

    //剪切
    try
    {
    this.Cursor = Cursors.WaitCursor;
    string strTemp = richTextBoxSendInfo.SelectedText;
    if (strTemp.Equals(""))
    return;
    Clipboard.Clear();
    richTextBoxSendInfo.Cut();
    this.Cursor = Cursors.Default;
    }
    catch (System.Exception ex)
    {
    this.Cursor = Cursors.Default;
    CommonFunc.DisplayException(ex);
    }

    //撤销
    try
    {
    this.Cursor = Cursors.WaitCursor;
    richTextBoxSendInfo.Undo();
    this.Cursor = Cursors.Default;
    }
    catch (System.Exception ex)
    {
    this.Cursor = Cursors.Default;
    CommonFunc.DisplayException(ex);
    }

  • 相关阅读:
    poj2388-Who's in the Middle(排序)
    poj1543-Perfect Cubes(暴力)
    poj1664-放苹果(递归)
    快速幂
    poj2389-Bull Math(大整数乘法)
    HDU2608-0 or 1(数论+找规律)
    poj1131-Octal Fractions(进制转换)
    [noip2011 d1t2]选择客栈
    [周记]8.7~8.16
    [noip2012d1t2] 国王游戏
  • 原文地址:https://www.cnblogs.com/linyijia/p/2971501.html
Copyright © 2011-2022 走看看