rtfdocument.cs

来自「xhtml到rtf的转换程序!带源码!」· CS 代码 · 共 48 行

CS
48
字号
using System;
using System.Drawing;

namespace RichTextBoxSupportsXHTML
{
	/// <summary>
	/// Summary description for RtfDocument.
	/// </summary>
	public class RtfDocument
	{
		private RtfFontTable fonttbl;
		private RtfColorTable colortbl;
		private string header;
		private string document;

		public RtfDocument()
		{
			//
			// TODO: Add constructor logic here
			//
			header = "{\\rtf1";
			fonttbl = new RtfFontTable();
			colortbl = new RtfColorTable();
		}

		public override string ToString()
		{
			header += fonttbl.ToString() + colortbl.ToString();
			return header + "{" + document + "}}";
		}

		public void AppendText(string text)
		{
			document += text;
		}

		public int UseFont(string fontName)
		{
			return fonttbl.UseFont(fontName);
		}

		public int UseColor(Color fromArgb)
		{
			return colortbl.UseColor(fromArgb);
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?