Disable selecting text in a TextBox

前端 未结 10 1834
再見小時候
再見小時候 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:26

    Attach to the SelectionChanged event, and inside the event set e.Handled = true; and the SelectionLength = 0; and that will stop the selection from occuring. This is similar to what it takes to keep a key press from happening.

提交回复
热议问题