在RichtText控件问题中显示文本,... [英] Displaying Text in a RichtText Control Problems,...

查看:47
本文介绍了在RichtText控件问题中显示文本,...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




i有这样的文字:


" ACPI\GENUINEINTEL _-_ X86_FAMILY_6_MODEL_13 \_0"


在将它作为RTF字符串显示在RichTextBox中后,我得到:


" ACPI _-_ x86_Family_6_Model_13"


我如何附上这个文本部分,以便RTF引擎

它是否完全按照添加的方式打印并且不处理

反斜杠和类似的东西作为控制角色,......


我知道它有点旧,但我不知道在哪里问,...


TIA,...


问候


Kerem

-

-----------------------

BesteGrüsse/致敬/ Votre bien devoue

KeremGümrükcü

最新项目: http://www.codeplex.com / restarts

最新的开源项目: http://entwicklung.junetz.de

--------------- --------

此回复按原样提供,不附带任何明示或暗示的保证。

解决方案

Hello Kerem,


如何在RichTextBox中插入字符串?


如果您使用该属性文字,它应该有用......类似于:


yourRichTextBox.Text = @" ACPI \GENUINEINTEL _-_ X86_FAMILY_6_MODEL_13\_0" ;;





yourRichTextBox.Text =" ACPI \\GENUINEINTEL _-_ X86_FAMILY_6_MODEL_13 \\_0";


干杯,

Caio Proiete





i有文字像这样:


" ACPI \GENUINEINTEL _-_ X86_FAMILY_6_MODEL_13 \_0"

将它作为RTF字符串显示在RichTextBox中,一世得到这个:


" ACPI _-_ x86_Family_6_Model_13"


如何附上此文本部分,以便RTF引擎执行此操作

完全按照它添加的方式打印并且不处理反斜杠和

之类的东西作为控制角色,......


我知道这有点旧,但我不知道在哪里问,...


TIA,...


问候


Kerem



Hi Caoi,


i insert是一个格式化的RichText,因为我想要一个

基本格式。 RTF字符串如下所示:

@" {\rtf1 {\ colortbl; \\\\\green128 \ blue {; \\\ t \\\ green0 \ blue255;} {\ b +

ObjectProperty.Name + @"} \par \ b0 {" + da.Description + @"} \par {\b

值:} \ cf1 \ b0" + ObjectValue + @" \ b0 \par}" ;;


摘自自制的属性网格,其中此块是

或描述的部分属性gridls面板下部的窗格。

RichTextBox的Rtf-Property的问题是\;反斜杠,

,因为它之后的所有内容都将被视为cotrol命令。但是那里有
必须以某种方式将String作为非Rtf字符串括起来或类似的东西

将字符串视为在一个RFT字符串里面,...


有没有办法


问候


Kerem


-

-----------------------

BesteGrüsse/致敬/ Votre bien devoue

KeremGümrükcü

最新项目: http://www.codeplex.com/restarts

最新的开源项目: http://entwicklung.junetz.de

------------- ----------

此回复按原样提供,不附带任何明示或暗示的保证。

" Caio Proiete [MCT] " < ca *************** @ proiete.comschrieb im Newsbeitrag

新闻:c6 *************** *********@msnews.microsoft.c om ...


Hello Kerem,


你如何在RichTextBox中插入字符串?


如果你使用属性文本,它应该工作...类似于:


yourRichTextBox.Text = @" ACPI \GENUINEINTEL _-_ X86_FAMILY_6_MODEL_13\_0" ;;





yourRichTextBox.Text = ACPI \\GENUINEINTEL _-_ X86_FAMILY_6_MODEL_13 \\__0;


干杯,

Caio Proiete

< blockquote class =post_quotes>
>

我有这样的文字:

" ACPI\GENUINEINTEL _-_ X86_FAMILY_6_MODEL_13\_0"

在将它作为RTF字符串显示在RichTextBox中之后,我得到了这个:

" ACPI _-_ x86_Family_6_Model_13"

我如何附上这个文本部分n,这样RTF引擎就可以完全按照添加方式进行打印,不会对反斜杠进行处理,也不会像控制角色那样对待......

我知道这是一个小小的OT,但我不知道在哪里问,...

TIA,...

关于

凯雷姆



Hum ..好的。


只需将每个反斜杠替换为*两个*反斜杠,就像在C#中那样,当你没有
时,使用@ :)。


类似于:


@" {\rtf1 {\ colortbl; \\\\\green128 \ blue0; \\\ lt0 \ green0 \ blue255;} {\b"

+ ObjectProperty.Name.Replace(@" \",@" \\" ;)

+ @"} \par \ b0 {"

+ da.Description

+ @"} \\ \\ par {\b值:} \ cf1 \ b0"

+ ObjectValue.ToString()。替换(@" \",@" \\" ;)

+ @" \ b0 \par}" ;;

这可能不是最有效的解决方案,但是......你应该想要使用StringBuilder并使用追加方法来构建正确的

RTF字符串...


-

Caio Proiete
http://www.caioproiete.com

-
< blockquote class =post_quotes>
嗨Caoi,

i insert是一个格式化的RichText,因为我想要一个基本格式的

它。 RTF字符串如下所示:


@" {\rtf1 {\ colortbl; \\\\\green128 \ blue12; \\\\\ green0 \ blue255; } {\b"

+ ObjectProperty.Name + @"} \ par \ b0 {" + da.Description + @"} \par {\b

值:} \ cf1 \ b0" + ObjectValue + @" \ b0 \par}" ;;


摘自一个自制的属性网格,这个区块是

的部分或描述属性下部的窗格

gridls面板。 RichTextBox的Rtf属性的问题是

\反斜杠,因为它之后的所有内容都将被视为

cotrol命令。但必须有一些方法将字符串作为

非Rtf字符串或类似的东西将字符串视为处理。在RFT内部

字符串,...


有没有办法


问候


Kerem



Hi,

i have text like this:

"ACPI\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\_0"

an after displaying it in a RichTextBox as RTF string, i get this:

"ACPI_-_x86_Family_6_Model_13 "

How can i enclose this text section, so that the RTF Engine
does it print exactly the way it is add and does not treat
backslashes and stuff like that as control charatcers,...

I know that it is a little OT, but i did not kow where to ask,...

TIA,...

Regards

Kerem
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."

解决方案

Hello Kerem,

How are you inserting the string in the RichTextBox?

If you use the property "Text", it should work... Something like:

yourRichTextBox.Text = @"ACPI\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\_0";

or

yourRichTextBox.Text = "ACPI\\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\\_0";

Cheers,
Caio Proiete

Hi,

i have text like this:

"ACPI\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\_0"

an after displaying it in a RichTextBox as RTF string, i get this:

"ACPI_-_x86_Family_6_Model_13 "

How can i enclose this text section, so that the RTF Engine does it
print exactly the way it is add and does not treat backslashes and
stuff like that as control charatcers,...

I know that it is a little OT, but i did not kow where to ask,...

TIA,...

Regards

Kerem



Hi Caoi,

i insert is as a formated RichText, because i want a
basic format for it. The RTF String looks like:
@"{\rtf1 {\colortbl ;\red0\green128\blue0;\red0\green0\blue255;}{\b " +
ObjectProperty.Name + @"} \par \b0 {" + da.Description + @"}\par {\b
Value: }\cf1\b0 " + ObjectValue + @" \b0 \par}";

Its an excerpt from an self-made property grid, where this block is the part
or the description pane in the lower part of the property gridls panel. The
Problem for the Rtf-Property of the RichTextBox are the "\" Backslashes,
since everything after it will be considered as a cotrol command. But there
must be some way to enclose the String as a non Rtf string or like something
"treat the string as is" inside a RFT string,...

Is there a way

Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
"Caio Proiete [MCT]" <ca***************@proiete.comschrieb im Newsbeitrag
news:c6************************@msnews.microsoft.c om...

Hello Kerem,

How are you inserting the string in the RichTextBox?

If you use the property "Text", it should work... Something like:

yourRichTextBox.Text = @"ACPI\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\_0";

or

yourRichTextBox.Text = "ACPI\\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\\_0";

Cheers,
Caio Proiete

>Hi,

i have text like this:

"ACPI\GENUINEINTEL_-_X86_FAMILY_6_MODEL_13\_0"

an after displaying it in a RichTextBox as RTF string, i get this:

"ACPI_-_x86_Family_6_Model_13 "

How can i enclose this text section, so that the RTF Engine does it
print exactly the way it is add and does not treat backslashes and
stuff like that as control charatcers,...

I know that it is a little OT, but i did not kow where to ask,...

TIA,...

Regards

Kerem



Hum.. Okay.

Just replace each backslash to *two* backslashes, as do in C# when you don''t
use the "@" :).

Something like:

@"{\rtf1 {\colortbl ;\red0\green128\blue0;\red0\green0\blue255;}{\b "
+ ObjectProperty.Name.Replace(@"\", @"\\")
+ @"} \par \b0 {"
+ da.Description
+ @"}\par {\b Value: }\cf1\b0 "
+ ObjectValue.ToString().Replace(@"\", @"\\")
+ @" \b0 \par}";
This is probably not be the most efficient solution, though... You should
think of using a StringBuilder and use the Append method to build the correct
RTF string...

--
Caio Proiete
http://www.caioproiete.com
-

Hi Caoi,

i insert is as a formated RichText, because i want a basic format for
it. The RTF String looks like:

@"{\rtf1 {\colortbl ;\red0\green128\blue0;\red0\green0\blue255;}{\b "
+ ObjectProperty.Name + @"} \par \b0 {" + da.Description + @"}\par {\b
Value: }\cf1\b0 " + ObjectValue + @" \b0 \par}";

Its an excerpt from an self-made property grid, where this block is
the part or the description pane in the lower part of the property
gridls panel. The Problem for the Rtf-Property of the RichTextBox are
the "\" Backslashes, since everything after it will be considered as a
cotrol command. But there must be some way to enclose the String as a
non Rtf string or like something "treat the string as is" inside a RFT
string,...

Is there a way

Regards

Kerem



这篇关于在RichtText控件问题中显示文本,...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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