问题
For Append Text
private void AddText(string text)
{
string[] str = text.Split(new string[] { ";" },
StringSplitOptions.RemoveEmptyEntries);
if (str.Length == 2)
{
richTextBox1.DeselectAll();
richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont, FontStyle.Bold);
richTextBox1.AppendText(Environment.NewLine + str[0] + ";");
richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont, FontStyle.Regular);
richTextBox1.AppendText(str[1]);
}
}
For Append Image
Image image = Image.FromFile("Logo.jpg");
// Put the image on the clipboard
Clipboard.SetImage(image);
//// Paste it into the rich tetx box.
richTextBox1.Paste();
I do not know how can create RichTextBox like This image?
回答1:
You can create a 2 rows x 3 columns table and add the elements to the corresponding cells. If you don't want its borders to appear use the \brdrcf1
tag with white color from the color table.
More about rtf tables:
Using Tables in RTF
来源:https://stackoverflow.com/questions/11086041/append-text-and-image-in-richtextbox