编辑后保留突出显示的文本颜色(Retain highlighted color of text after editing)

在删除前面的行内容后,无法保留我在我的文本上设置的RichTextBox中突出显示的效果。

无论我从控件中删除多少文本,它总是删除自定义SelectionColor和SelectionBackColor我设置为已包含在其中的文本。

我的删除方法代码:

private void btnRemove_Click(object sender, EventArgs e)
{
    //Remove selected line from RichTextBox
    richTextBox1.Text = richTextBox1.Text.Remove(richTextBox1.Text.Length - 1, 1);
    //Remove all blank lines remaining after deletion                  
    richTextBox1.Text = Regex.Replace(richTextBox1.Text, @"^\s*$(\n|\r|\r\n)", "", RegexOptions.Multiline);
}

我想在这里删除的字母数是1,因为单词“AND”是通过剪贴板粘贴方法插入的简单图像。

在此处输入图像描述


Cannot keep the highlighted effect I set in my RichTextBox on my text after removing content of a line in front of him.

No matter how much text I remove from the control it always removes the custom SelectionColor and SelectionBackColor I set to a text already contained in it.

Code of my Removal method:

private void btnRemove_Click(object sender, EventArgs e)
{
    //Remove selected line from RichTextBox
    richTextBox1.Text = richTextBox1.Text.Remove(richTextBox1.Text.Length - 1, 1);
    //Remove all blank lines remaining after deletion                  
    richTextBox1.Text = Regex.Replace(richTextBox1.Text, @"^\s*$(\n|\r|\r\n)", "", RegexOptions.Multiline);
}

The number of letters I want to remove here is 1 as the word "AND" is a simple image inserted by means of Clipboard Paste method.

enter image description here


原文:https://stackoverflow.com/questions/37064223
2022-04-20 10:04

满意答案

我会使用https://github.com/yaronn/blessed-contrib它带有很多内置的小部件。


I would use https://github.com/yaronn/blessed-contrib it comes with a lot of widgets built-in.

相关问答

更多

使用套接字激发流,在控制台中设置SCHEMA,显示DATAFRAME(Spark Structured Streaming using sockets, set SCHEMA, Display DATAFRAME in console)

TextSocketSource不提供任何集成的解析选项。 只能使用以下两种格式之一: 时间戳和文本,如果includeTimestamp设置为true ,则使用以下模式: StructType([ StructField("value", StringType()), StructField("timestamp", TimestampType()) ]) 仅当includeTimestamp设置为false且模式如下所示时才includeTimestamp文本: Struct...

NodeJs如何在控制台中显示表结构化仪表板(NodeJs how to display table structured dashboard in console)

我会使用https://github.com/yaronn/blessed-contrib它带有很多内置的小部件。 I would use https://github.com/yaronn/blessed-contrib it comes with a lot of widgets built-in.

仪表板显示问题/布局/绘图/反应/ UI(Dashboard display issues / layout / plot / reactive / UI)

如果你想在左边有按钮并在右边画图,我想你应该把你的页面分成两部分。 像这样的东西: tabItem(tabName = "Sales_Performance", fluidRow(title= "Sales Breakdown",width = 500, column(4, sliderInput("monthInput","Month",min=1,max = 12,step = 1,c(25,45)), ...

在oxwall的用户仪表板中显示用户通知(Display user notifications in User dashboard in oxwall)

要在用户的仪表板页面中显示用户的通知,请按照Widget构造中的以下代码进行操作。 $this->service = NOTIFICATIONS_BOL_Service::getInstance(); $userid = OW::getUser()->getId(); $allNotificationCount = $this->service->findNotificationCount($userid); // Get the notifications of currently logg...

通过API在New Relic仪表板上显示图表(Displaying the charts from the New Relic dashboard over the API)

将鼠标悬停在New Relic Dashboard中的图表上时,该图表的右下角会出现“+”。 您可以单击“+”然后选择“嵌入”以创建html可嵌入链接。 只要您在创建图表时将时间范围设置为“立即结束”,图表就会在您嵌入图表的任何页面上主动更新。 When you hover over a chart in the New Relic Dashboard, a "+" will appear in the lower right corner of that chart. You can click...

Wordpress在User Profile仪表板上显示自定义USERMETA字段?(Wordpress to display custom USERMETA field on User Profile Dashboard?)

现在没关系,因为我自己就是这样做的,就像这样: add_action( 'show_user_profile', 'display_user_custom_hash' ); add_action( 'edit_user_profile', 'display_user_custom_hash' ); function display_user_custom_hash( $user ) { ?> <h3>USERMETA Fields</h3> <table class="form-...

如何在树视图中显示分层结构化的数据库?(how to display an hierarchical structured database in tree view?)

看到我的代码如下 - 你只需要把你的确切设计放在这里 $servername = "localhost"; $username = "root"; $password = "psswd_here"; $dbname = "db_here"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $con...

如何在CloudKit仪表板中使用“fetchWithRecordID”自动生成ID?(How to use “fetchWithRecordID” for automatically generated ID in CloudKit Dashboard?)

这是两个不同的问题 查询ID时,您必须像在第二个示例中一样查询CKRecordID 访问UI时,您必须在主队列上执行此操作。 那么代码就像这样: publicDB.fetchRecordWithID(CKRecordID(recordName: "f7080e7a-f8c3-4db6-b8ee-642a011a6762"), completionHandler: {record, error in if error != nil { println("there was a...

如何在sonarqube仪表板上显示指标值?(How to display metric value on sonarqube dashboard?)

format_measure确实是在窗口小部件中打印出度量值的正确帮助器。 您可能有几个原因没有看到该指标的衡量标准: 你没有对项目进行任何分析,在这种情况下你的插件还没有推动该指标的衡量标准 您的插件无法正确测量该指标 例如:它在文件级别推送措施,但不在项目级别推送 无论如何,您可以查看我们的示例插件以了解更多信息,更具体地说,可以查看窗口小部件模板 。 The format_measure is indeed the correct helper to print out the value ...

如何在wso2 das中查看哪个分析表绑定到仪表板(How to see which analytic table is bound to the dashboard in wso2 das)

首先,我假设您使用“小工具向导”创建了小工具(如果没有请告诉我) 然后,可以在以下配置文件中找到分析表名称。 gadget_folder/js/gadgetconf.js 在上面的配置文件中,将有一个名为“datasource”的属性,它指向实际的分析表。 谢谢, Upul First of all, I assume that you have created gadgets using "Gadget Wizard" (if not please let me know) Then the ...

相关文章

更多

网络挖掘技术——text mining

一、中文分词:分词就是利用计算机识别出文本中词汇的过程。 1.典型应用:汉字处理:拼音输入法、手写识别 ...

Full-Text Search in ASP.NET using Lucene.NET

This post is about the full-text search engine ...

Solr官方文档系列——Text Analysis

Text fields are typically indexed by breaking the t ...

jquery 怎么得到link中text的属性

&lt;a href=&quot;http://www.baidu.com&quot;&gt;r亮高亮 ...

企业级搜索引擎Solr 第二章 Schema和文本分析(Schema and Text Analysis)[2]

文章转载自网易博客,原文地址:http://quweiprotoss.blog.163.com/blo ...

java.text.DecimalFormat 的问题

各位好,我用java.text.DecimalFormat做一些格式化的工作,我的代码如下: Dec ...

Django and full-text search

Structure in the flow &raquo; Blog Archive &raquo; ...

用‘button’跟‘text’组合代替‘file’,选择文件后点‘submit’,‘file’的值被清空

各位大虾晚上好,我有个问题想请教你们,我想美化html的file外观,但貌似现在还不能用css直接设计 ...

java double 保留两位小数

java的double类型要保留两位小数有四种方法,都是四舍五入,例: import java.mat ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本