How to make text in WinForms TextBox unselected without disabling it?

Is it possible to make the text in the TextBox unselected without disabling the TextBox? It is a RichTextBox and I need its formatting and selection functions. I cannot turn it off because I want to handle the MouseMove and MouseDown events.

So far I've been thinking about disabling the Text field and putting a panel on top of it that delegates its events to the text field handlers, but I can't make the panel transparent so that it hides the text field.

Thank.

+1


source to share


3 answers


What do I do with .Enter or .GotFocus events to clear my selections?
You can see the opposite of what you wanted in Automatically select all focus text in WinForms TextBox .



+3


source


How to handle selection change event as follows:



    private void richTextBox1_SelectionChanged(object sender, EventArgs e)
    {
        this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
    }

      

+2


source


I'm not really sure what you are getting (needs something unselectable, but its select function needs it), but does it set to ReadOnly

true what you are looking for?

0


source







All Articles