How to change the font color of a disabled TextBox?

后端 未结 9 640
被撕碎了的回忆
被撕碎了的回忆 2020-11-27 05:13

Does anyone know which property sets the text color for disabled control? I have to display some text in a disabled TextBox and I want to set its color to blac

9条回答
  •  温柔的废话
    2020-11-27 06:18

    In addition to the answer by @spoon16 and @Cheetah, I always set the tabstop property to False on the textbox to prevent the text from being selected by default.

    Alternatively, you can also do something like this:

    private void FormFoo_Load(...) {
        txtFoo.Select(0, 0);
    }
    

    or

    private void FormFoo_Load(...) {
        txtFoo.SelectionLength = 0;
    }
    

提交回复
热议问题