----赖格英-----

记忆不好了,记录工作中的点点滴滴....

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.IO;

namespace test
{
	/// <summary>
	/// Description of MainForm.
	/// </summary>
	public partial class MainForm : Form
	{
		public MainForm()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
		}
		
		void Button1Click(object sender, EventArgs e)
		{
			richTextBox1.Focus();
			richTextBox1.Select(0, richTextBox1.Rtf.Length);
		}
		
		void Button2Click(object sender, EventArgs e)
		{
			Clipboard.SetData(DataFormats.Rtf, richTextBox1.SelectedRtf);//
		}
		
		void Button4Click(object sender, EventArgs e)
		{
			Clipboard.SetData(DataFormats.Rtf, richTextBox1.SelectedRtf);//复制RTF数据到剪贴板

            richTextBox1.SelectedRtf="";//再把当前选取的RTF内容清除掉,当前就实现剪切功能了.
		}
		
		void Button3Click(object sender, EventArgs e)
		{
			richTextBox1.Focus();
			richTextBox1.Paste();//
		}
		
		void Button5Click(object sender, EventArgs e)
		{
			FileStream fs=new FileStream("F:\\ppp.rtf",FileMode.Create ,FileAccess.Write);
			richTextBox1.SaveFile(fs,RichTextBoxStreamType.RichText);
			fs.Close();
		}
	}
}

 

posted on 2016-12-12 23:04  向北方  阅读(1168)  评论(0编辑  收藏  举报