复制:

1 private void CopytoolStripMenuItem_Click(object sender, EventArgs e)  

2 {//复制  

3             try  

4             {  

5                 this.Cursor = Cursors.WaitCursor;  

6                 string strTemp = richTextBoxSendInfo.SelectedText;  

7 //获取RichTextBox中选中的文字  

8                 if (strTemp.Equals(""))     //判断是否为空  

9                     return;  

10                 Clipboard.Clear();//清除原有剪切板中内容  

11                 Clipboard.SetText(strTemp);//将文字添加到剪切板中,还添加Object类型数据  

12                 this.Cursor = Cursors.Default;  

13             }  

14             catch (System.Exception ex)  

15             {  

16                 this.Cursor = Cursors.Default;  

17                 CommonFunc.DisplayException(ex);  

18             }  

19         }  

 

剪切:

20 private void CuttoolStripMenuItem_Click(object sender, EventArgs e)  

21         {//剪切  

22             try  

23             {  

24                 this.Cursor = Cursors.WaitCursor;  

25                 string strTemp = richTextBoxSendInfo.SelectedText;  

26                 if (strTemp.Equals(""))  

27                     return;  

28                 Clipboard.Clear();  

29                 richTextBoxSendInfo.Cut();  

30                 this.Cursor = Cursors.Default;  

31             }  

32             catch (System.Exception ex)  

33             {  

34                 this.Cursor = Cursors.Default;  

35                 CommonFunc.DisplayException(ex);  

36             }  

37   

38         }  

 

撤销:

39 private void ReDotoolStripMenuItem_Click(object sender, EventArgs e)  

40         {//撤销  

41             try  

42             {  

43                 this.Cursor = Cursors.WaitCursor;  

44                 richTextBoxSendInfo.Undo();  

45                 this.Cursor = Cursors.Default;  

46             }  

47             catch (System.Exception ex)  

48             {  

49                 this.Cursor = Cursors.Default;  

50                 CommonFunc.DisplayException(ex);  

51             }  

52   

53         }  

posted on 2018-01-15 15:15  Javen_blog  阅读(173)  评论(0编辑  收藏  举报