/// <summary> /// Calculate or render the contents of our RichTextBox for printing /// </summary> /// <param name="rtb"></param> /// <param name="measureOnly"></param> /// <param name="graph"></param> /// <param name="renderRect">输出区域,单位:pixel</param> /// <returns>RTF是否已经完整输出</returns> protected bool FormatRangeCore(RichTextBox rtb, bool measureOnly, Graphics graph, Rectangle renderRect) { int charindex = 0; charindex = RtfPrintNativeMethods.FormatRange(rtb, measureOnly, graph, renderRect, renderRect, 0, rtb.TextLength); if (charindex < rtb.TextLength) { return(false); } return(true); }
/// <summary> /// 上标按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSuper_Click(object sender, EventArgs e) { if (txtRTF.SelectionLength == 0) { return; } int startindex = txtRTF.SelectionStart; int length = txtRTF.SelectionLength; for (int i = startindex; i < startindex + length; i++) { txtRTF.Select(i, 1); RtfPrintNativeMethods.SetSelectionSuperscript(txtRTF, true); } }