<bdo id='gS65q'></bdo><ul id='gS65q'></ul>

  1. <legend id='gS65q'><style id='gS65q'><dir id='gS65q'><q id='gS65q'></q></dir></style></legend>

    <i id='gS65q'><tr id='gS65q'><dt id='gS65q'><q id='gS65q'><span id='gS65q'><b id='gS65q'><form id='gS65q'><ins id='gS65q'></ins><ul id='gS65q'></ul><sub id='gS65q'></sub></form><legend id='gS65q'></legend><bdo id='gS65q'><pre id='gS65q'><center id='gS65q'></center></pre></bdo></b><th id='gS65q'></th></span></q></dt></tr></i><div id='gS65q'><tfoot id='gS65q'></tfoot><dl id='gS65q'><fieldset id='gS65q'></fieldset></dl></div>

    1. <small id='gS65q'></small><noframes id='gS65q'>

    2. <tfoot id='gS65q'></tfoot>
    3. RichTextBox 从文本中删除转义字符

      RichTextBox removes escape character from the text(RichTextBox 从文本中删除转义字符)
        • <small id='HSFlR'></small><noframes id='HSFlR'>

          <i id='HSFlR'><tr id='HSFlR'><dt id='HSFlR'><q id='HSFlR'><span id='HSFlR'><b id='HSFlR'><form id='HSFlR'><ins id='HSFlR'></ins><ul id='HSFlR'></ul><sub id='HSFlR'></sub></form><legend id='HSFlR'></legend><bdo id='HSFlR'><pre id='HSFlR'><center id='HSFlR'></center></pre></bdo></b><th id='HSFlR'></th></span></q></dt></tr></i><div id='HSFlR'><tfoot id='HSFlR'></tfoot><dl id='HSFlR'><fieldset id='HSFlR'></fieldset></dl></div>

            <legend id='HSFlR'><style id='HSFlR'><dir id='HSFlR'><q id='HSFlR'></q></dir></style></legend>

              <tbody id='HSFlR'></tbody>

                <bdo id='HSFlR'></bdo><ul id='HSFlR'></ul>
              • <tfoot id='HSFlR'></tfoot>
                本文介绍了RichTextBox 从文本中删除转义字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                在将文本添加到 RichTextBox 中的 RTF 属性之前,我对文本进行了一些处理,添加了转义字符,然后将数据划分为多行.

                before adding the text to RTF property in RichTextBox, i make some processing on the text, add escape character then divide the data to multiline.

                文字是

                line1 u001aline2 u001aline3 u001aline4

                line1 u001aline2 u001aline3 u001aline4

                当我将 VS 2015 与 .Net 4.6.2 一起使用时RTF 属性中的值为

                When i use VS 2015 with .Net 4.6.2 the value in RTF property is

                {\rtf1\fbidis\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 
                Arial;}}
                \viewkind4\uc1\pard\ltrpar\lang3073\fs24 Line1 
                \par
                \v\'1a\v0 Line2
                \par
                \v\'1a\v0 Line3
                \par
                \v\'1a\v0 Line4\par
                }
                
                

                但是当我使用 .Net 4.7.1 切换到 VS 2017 时值改为

                but when i switched to VS 2017 with .Net 4.7.1 the value changed to

                {\rtf1\fbidis\ansi\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0
                Arial;}}
                {\*\generator Riched20 10.0.16299}\viewkind4\uc1
                
                \pard\ltrpar\fs24\lang1033 Line1
                \par
                \v\'1a\v0 Line2 \par
                \v\'1a\v0
                Line3 \par
                
                \pard\ltrpar\v\'1a\v0
                Line4\par
                }
                
                

                当我访问 Text 属性时,我得到了这个 Text

                and when i accessed the Text property i got this Text

                Line1 Line2 Line3 Line4

                Line1 Line2 Line3 Line4

                RichTextBox 在 VS 2017 中删除了转义字符,有人知道为什么吗?

                RichTextBox removes the escape character in VS 2017 anyone knows Why?

                推荐答案

                当您的应用程序面向 .NET 4.6.2(或更低版本)时,RichTextBox 会实例化 RichEdit 控件版本 3(版本描述 此处),当您的应用程序重定向到 .NET 4.7 时.1,它实例化 Rich Edit 版本 4.1 (msftedit.dll).RTF 表示的差异很可能是由较新版本的控件引起的.即使您的应用程序面向 4.7 及更高版本,您也可以通过在 AppContextSwitchOverrides 标记下添加具有以下兼容性开关的 app.config 文件来选择退出使用较新版本的 Rich Edit:

                When your application targets .NET 4.6.2 (or below), RichTextBox instantiates RichEdit control version3 (versions are described here), when your application is retargeted to .NET 4.7.1, it instantiates Rich Edit version 4.1 (msftedit.dll). Difference in RTF representation is most likely caused by the newer version of the control. You can opt-out from using the newer version of Rich Edit even when your application targets 4.7 and above by adding app.config file with the following compatibility switch under AppContextSwitchOverrides tag:

                <?xml version="1.0" encoding="utf-8"?>
                <configuration>
                  <startup>
                    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/>
                  </startup>
                  <runtime>
                    <AppContextSwitchOverrides
                      value="Switch.System.Windows.Forms.DoNotLoadLatestRichEditControl=true" />
                  </runtime>
                </configuration>
                

                相反,您可以通过将上述 AppContextSwitch 设置为 false,在面向 .NET 4.6.2 的应用程序中加载 Rich Edit 4.1.

                Conversely you can load Rich Edit 4.1 in an application that targets .NET 4.6.2 by setting the above AppContextSwitch to false.

                这篇关于RichTextBox 从文本中删除转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)
                Parameter count mismatch with Invoke?(参数计数与调用不匹配?)
                How to store delegates in a List(如何将代表存储在列表中)
                How delegates work (in the background)?(代表如何工作(在后台)?)
                C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)
                Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)

                    <tfoot id='avma2'></tfoot>

                    <small id='avma2'></small><noframes id='avma2'>

                        <tbody id='avma2'></tbody>

                    • <legend id='avma2'><style id='avma2'><dir id='avma2'><q id='avma2'></q></dir></style></legend>
                      • <bdo id='avma2'></bdo><ul id='avma2'></ul>

                          <i id='avma2'><tr id='avma2'><dt id='avma2'><q id='avma2'><span id='avma2'><b id='avma2'><form id='avma2'><ins id='avma2'></ins><ul id='avma2'></ul><sub id='avma2'></sub></form><legend id='avma2'></legend><bdo id='avma2'><pre id='avma2'><center id='avma2'></center></pre></bdo></b><th id='avma2'></th></span></q></dt></tr></i><div id='avma2'><tfoot id='avma2'></tfoot><dl id='avma2'><fieldset id='avma2'></fieldset></dl></div>