Disable selecting text in a TextBox

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

    You can use a disabled RichTextBox and reset the color to black afterwards.

    RichTextBox rtb = new RichTextBox();
    rtb.IsEnabled = false;
    rtb.Text = "something";
    rtb.SelectAll();
    rtb.SelectionColor = Color.Black;
    rtb.SelectedText = String.Empty;
    

提交回复
热议问题