rtffonttable.cs
来自「xhtml到rtf的转换程序!带源码!」· CS 代码 · 共 48 行
CS
48 行
using System;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
namespace RichTextBoxSupportsXHTML
{
/// <summary>
/// Summary description for RtfFontTable.
/// </summary>
public class RtfFontTable
{
private int numberOfFonts = 0;
private string fonttbl;
private Hashtable loadedFonts = new Hashtable();
public RtfFontTable()
{
//
// TODO: Add constructor logic here
//
fonttbl = "{\\fonttbl{\\f0\\froman Times New Roman;}";
}
public int UseFont(string fontName)
{
if (loadedFonts.Contains(fontName))
{
return (int)loadedFonts[fontName];
}
else
{
fonttbl += "{\\f" + (++numberOfFonts) + "\\fnil " + fontName + ";}";
loadedFonts.Add(fontName, numberOfFonts);
return numberOfFonts;
}
}
public override string ToString()
{
return fonttbl + "}";
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?