views:

10

answers:

1

I have a winforms app with a series of textboxes and one rich textbox. Upon a button click I would like to set all the fields to being readonly. The only issue with this is that the background color of a readonly richtextbox is white as opposed to the grey used by the textboxes.

I have tried setting the backcolor property of the richtextbox to being Color.LightGrey but this is not the same grey used by the textboxes. I have also tried setting the back color to being the backcolor of one of the readonly textboxes but this does not work either.

My question is really is what is the best way to get a readonly rich text box that looks like a readonly text box?

Many thanks

+2  A: 

It is the "Control" system color. Battleship gray by default. In code:

        richTextBox1.BackColor = Color.FromKnownColor(KnownColor.Control);
Hans Passant