<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[עזרה ב c# | סימון מילים ב richTextBox]]></title><description><![CDATA[<p dir="rtl">אני רוצה שכשכותבים מילה בrichTextBox1 (לדוגמא "start")<br />
היא תהיה בצבע אדום<br />
(דומה לnotepad ++)<br />
<img src="/assets/uploads/files/1611852627071-d6f2c01e-e5c7-4770-b0a9-28d8523d653e-image.png" alt="d6f2c01e-e5c7-4770-b0a9-28d8523d653e-image.png" class=" img-fluid img-markdown" /></p>
<p dir="rtl">זה הקוד שעשיתי, כל פעם שכותבים ב richTextBox1 הוא עושה חיפוש ואם הוא מוצא "start" הוא הופך אותו לאדום<br />
הבעיה שבכל אות שכותבים העכבר עובר להתחלה</p>
<pre><code>        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {
            string[] words = "start".Split(',');
            foreach (string word in words)
            {
                int startIndex = 0;
                while (startIndex &lt; richTextBox1.TextLength)
                {
                    int wordStartIndex = richTextBox1.Find(word, startIndex, RichTextBoxFinds.None);
                    if (wordStartIndex != -1)
                    {
                        richTextBox1.SelectionStart = wordStartIndex;
                        richTextBox1.SelectionLength = word.Length;
                        richTextBox1.SelectionColor = Color.Red;
                    }
                    else
                        break;
                    startIndex += wordStartIndex + word.Length;
                }
            }
        }
</code></pre>
<p dir="rtl">תודה רבה!</p>
]]></description><link>https://tchumim.com/topic/10609/עזרה-ב-c-סימון-מילים-ב-richtextbox</link><generator>RSS for Node</generator><lastBuildDate>Tue, 06 Oct 2026 12:27:39 GMT</lastBuildDate><atom:link href="https://tchumim.com/topic/10609.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Jan 2021 16:56:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to עזרה ב c# | סימון מילים ב richTextBox on Thu, 28 Jan 2021 17:49:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/odeddvir" aria-label="Profile: odeddvir">@<bdi>odeddvir</bdi></a> תודה רבה!!</p>
]]></description><link>https://tchumim.com/post/117880</link><guid isPermaLink="true">https://tchumim.com/post/117880</guid><dc:creator><![CDATA[נ נח]]></dc:creator><pubDate>Thu, 28 Jan 2021 17:49:19 GMT</pubDate></item><item><title><![CDATA[Reply to עזרה ב c# | סימון מילים ב richTextBox on Thu, 28 Jan 2021 20:06:38 GMT]]></title><description><![CDATA[<p dir="rtl"><a class="plugin-mentions-user plugin-mentions-a" href="/user/%D7%A0-%D7%A0%D7%97" aria-label="Profile: נ-נח">@<bdi>נ-נח</bdi></a> זה בגלל שהפונקציה משנה את מיקום הסמן.<br />
אתה צריך לשמור את המיקום הנוכחי בתחילת הפונקציה, וביציאה להזיז לשם את הסמן.<br />
תוסיף בתחילת הפונקציה את השורה הבאה:</p>
<pre><code> var currentPosition = richTextBox1.SelectionStart;
</code></pre>
<p dir="rtl">ובסוף לפני היציאה מהפונקציה:</p>
<pre><code>richTextBox1.Select(currentPosition , 0);
</code></pre>
]]></description><link>https://tchumim.com/post/117877</link><guid isPermaLink="true">https://tchumim.com/post/117877</guid><dc:creator><![CDATA[OdedDvir]]></dc:creator><pubDate>Thu, 28 Jan 2021 20:06:38 GMT</pubDate></item></channel></rss>