追加两个的RichTextbox内容作为单个富文本串 [英] Appending Contents of two RichTextbox as a single RichText string

查看:338
本文介绍了追加两个的RichTextbox内容作为单个富文本串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要追加两富文本框的内容在Windows窗体.NET应用程序;说: stringText = richtextbox1.Rtf + richtextbox2.Rtf; stringText 应该是RTF文本,里面应该有\ RTF行一次,有串联丰富的文本。

I want to append the contents of two rich text boxes in a Windows Forms .Net application; say: stringText = richtextbox1.Rtf + richtextbox2.Rtf; The stringText should be RTF text, which should have \rtf line once, having concatenated rich text.

剪贴板的范围并不在这里。

The Clipboard is not in scope here.

另外,我很好奇,如果我们能去合并。

Also, I'm curious, if we can de-merge them.

推荐答案

试试这个:

richTextBoxTarget.Select(richTextBoxTarget.TextLength, 0);
richTextBoxTarget.SelectedRtf = richTextBoxSource.Rtf;

此合并richTextBoxSource的内容richTextBoxTarget的末端。它会自动只有一个\ RTF标记创建有效的RTF。
要取消合并,也可以使用选择 SelectedRtf 。这里唯一的要求是,你需要知道,在什么位置,你要分割。

This merges the contents of richTextBoxSource to the end of richTextBoxTarget. It automatically creates valid RTF with only one \rtf tag.
To de-merge, also use Selectand SelectedRtf. The only requirement here is, that you need to know, at what position you want to split.

这篇关于追加两个的RichTextbox内容作为单个富文本串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆