private void btnSetBold_Click(object sender, EventArgs e) { int start = this.richTextBox1.SelectionStart; int length = this.richTextBox1.SelectionLength; string original = this.richTextBox1.Text.Substring(start, length); if (!string.IsNullOrEmpty(original)) { string newValue = RTFUtility.Bold(original); } }
private void btnSetItalic_Click(object sender, EventArgs e) { string content = RTFUtility.Bold("斜体内容"); this.richTextBox1.AppendText(content); }