我有一个RichTextBox。我正在努力编写代码,以便如果在SelectionBackColor属性中找到特定颜色,将删除单词/文本的背景色。为此,我需要检测RTB中是否存在多种颜色。然而,根据的说法,
如果当前文本选择有多个指定的颜色,则此属性返回Color.Empty。
这就是我迄今为止尝试过的:
private void randomBtn_Click(object sender, EventArgs e)
{
int startIndex = 0; //start from beginning of the richTextBox1
int endIndex
我想要做的是在文本框中搜索特定的字符串,然后用红色更改前颜色,到目前为止,它是有效的:
Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
Dim loc As Integer
'check if it contains the <html> tag and if it does select it and change the colour to red.
If RichTextBox
我在VB.NET 2010上做实验,尝试更改特定文本的颜色。
我创建了一个捕获当前窗口标题的计时器,并在RichTextBox中实现了它:
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles activetitle.Tick
If strin <> GetActiveWindowTitle() Then
RichTextBox1.Text = RichTextBox1.Text & vbNewLine
嗨,我有一个从富文本框中查找单词并改变字体颜色的代码,代码是有效的,但是如果我返回并编辑以前的文本到一些我不想着色的东西,颜色不会消失。这是我的密码
Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
Dim S As Integer = RichTextBox1.SelectionStart
Dim html() As String = {"<!DOCTYPE html>", "<
我使用了一个richTextBox,这样用户就可以看到他们拥有的XML文件,并允许他们编辑它。我有一些代码,改变关键字的颜色为我指定的颜色。这是我使用的方法:
private void CheckKeyword(string word, Color color, int startIndex)
{
if (this.richTextBox.Text.Contains(word))
{
int index = -1;
int selectStart = this.richTextBox.SelectionSt
嘿,我正在把图片转换成ASCII格式。为此,我加载图像,对每个像素使用getPixel(),然后将具有该颜色的字符插入到richTextBox中。
Bitmap bmBild = new Bitmap(openFileDialog1.FileName.ToString()); // valid image
int x = 0, y = 0;
for (int i = 0; i <= (bmBild.Width * bmBild.Height - bmBild.Height); i++)
{
//
我希望改变一个richTextBox的背景颜色时,用户点击它。我想我需要一个点击事件。颜色应该是特定的,这样才不会使文本难以阅读。我想我需要一个列表或数组来选择颜色。我不认为我需要一个随机函数,而只需要一种改变richTextBox颜色的方法。有什么想法吗?
谢谢
#Generated Form Function
function GenerateForm {
#######################################################################
# Generated On: 8/30/2016 4:54 PM
# Generated
我正在制作一个基于文本的RPG风格的游戏。目前它在控制台应用程序中,但我更愿意将其移动到Windows窗体应用程序中,以获得一些额外的功能和美感。这带来了一些问题。
颜色区分消息的类型,因此颜色很重要。我在另一个问题上发现了这个:
int length = richTextBox.TextLength; // at end of text
richTextBox.AppendText(mystring);
richTextBox.SelectionStart = length;
richTextBox.SelectionLength = mystring.Length;
richTextBo
我试图将特定字符串的颜色更改为richTextBox,在其中打开文本文档,使其成为已经存在的字符串,或者通过richTextBox添加,以保存除特定行之外的其他文本。
我进入了richTextBox_TextChanged事件,但不适合我。它很好地更改了特定字符串的文本,并保持了其他文本的黑色,但在所有情况下,我都有两个相同的问题,第一:
如果我将文本添加到richTextBox中特定颜色的红色字符串中,与其他单词或字符合并,例如:
如果文本文档内容是:
some string
some string
red string
如果我再加上这样的话:
some string
some string
我在wpf和visual basic中工作。当我在RichTextBox中选择文本时,我使用TextRange:
dim selection1 as New TextRange(Richtextbox.selection.start,Richtextbox.selection.end)
稍后:
selection1.ApplyPropertyValue(ForegroundProperty, brushes.Red)
当我多次标记文本时,颜色也会在之前的选择中发生变化。我只想改变颜色最后一次选择。该怎么做呢?
我不知道为什么,当我想要将richtextbox1.text颜色改为红色时,.net只是向我显示了错误
Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
Dim theColor As System.Drawing.Color
Dim loc As Int16
the colour to red.
If RichTextBox1.Text.Contains("CARD LOCKED")
因此,我在vb.net (使用FTP服务器)中进行了一次聊天,我希望对聊天中的每个名称进行颜色化,因此包含消息的文件如下所示:
#2George: HI
#2George: Hi geoo
并使用RichTextBox1 textchanged事件添加:
For Each line In RichTextBox1.Lines
If Not line Is Nothing Then
If line.ToString.Trim.Contains("#2") Then
Dim s$ = line.Trim
Ric
反正我似乎也找不到答案。但我的问题是;
在visual中,我想做一个叫做问题面板的东西,并测试它,我正在做一个调试。它使用进度条和计时器。以下是到目前为止的一些代码。
ProgressBar1.Increment(1)
If ProgressBar1.Value = 1 Then
RichTextBox1.Text = "A developer debug has been executed, please wait"
End If
If ProgressBar1.Value = 3 Then
RichT
我希望能够在不影响当前.SelectionBackColor或.SelectionColor的情况下突出显示(选择) RichTextBox中的文本
我有一个包含很多文本的RichTextBox。
我有一个包含字符串/单词列表的ListView,这些字符串/单词在ListView中具有不同的.BackColor和.ForeColor。
我循环遍历ListView项,并使用.SelectionBackColor和.SelectionColor在RichTextBox中突出显示相应的文本,设置文本颜色以匹配ListView中的.BackColor和.ForeColor。
For Each verI
我有一些PNG文件,有两种不同颜色的多个句子:黑色(Davy )和浅褐色(蘑菇)。
就像这样:
我只对黑色文本感兴趣,所以我试着用Input.ReplaceColor将浅褐色文本的颜色更改为背景色,但是这种颜色有很多不同的颜色,最后总是会有一些奇怪的字符,因为剩下的残余物很小。
这是我的实际代码
var Ocr = new IronTesseract();
using (var Input = new OcrInput())
{
var ContentArea = new Rectangle() { X = 872 , Y = 130, Height = 900, Width =