Note that there are some explanatory texts on larger screens.

plurals
  1. POStrange shift when Selecting text in richtext box v5 that contains hyperlinks
    primarykey
    data
    text
    <p>When I use the RichTextBox.Select(int start, int length) function to select text in a rich text box that contains hyperlinks, there is some shift in the selection when I try to select any text that is after the hyperlink.</p> <p>When I remove the hyperlink, the selection works properly.</p> <p><strong>Edit:</strong> I use RichTextBox 5 (the default in Visual Studio is version 4)</p> <pre><code>public class RichText50W : RichTextBox { [DllImport("kernel32.dll", CharSet = CharSet.Auto)] static extern IntPtr LoadLibrary(string lpFileName); protected override CreateParams CreateParams { get { CreateParams prams = base.CreateParams; if (LoadLibrary("msftedit.dll") != IntPtr.Zero) { prams.ClassName = "RICHEDIT50W"; } return prams; } } } </code></pre> <p>The problem occurs only with richtextbox 5+.</p> <p>These images show the problem and the difference in behavior.</p> <p>If you try this make sure to set HideSelection property of richtextboxes to "false".</p> <p>Select functions are displayed on the buttons.</p> <p><img src="https://i.stack.imgur.com/qgrCy.jpg" alt="Select (10, 1)"></p> <p>For RTB5, 'e' in "Text" should be selected in the above image.</p> <p><img src="https://i.stack.imgur.com/jaG5k.jpg" alt="Select (40, 1)"></p> <p><img src="https://i.stack.imgur.com/LWKb8.jpg" alt="Select (46, 1)"></p> <p>Apparently RTB5 selects some hidden text.</p> <p>I need it to select based on the visible text only.</p> <p>RTB 4 has problems when using tables, so I don't want to use it.</p> <p>I use .NET 2.0</p> <p><strong>Edit:</strong> To try this in Visual Studio, start with the default richtextbox and change its declaration to RichText50W instead of RichTextBox</p> <p>Also RichEdit 6 has the same issue.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload