Disable selecting text in a TextBox

前端 未结 10 1842
再見小時候
再見小時候 2020-12-06 12:42

I have a textbox with the following (important) properties:

this.license.Multiline = true;
this.license.ReadOnly = true;
this.license.ScrollBars = System.Win         


        
10条回答
  •  一个人的身影
    2020-12-06 13:34

    Since the standard TextBox doesn't have the SelectionChanged event, here's what I came up with.

    private void TextBox1_MouseMove(object sender, MouseEventArgs e)
    {
        TextBox1.SelectionLength = 0;
    }
    

提交回复
热议问题