This is a migrated thread and some comments may be shown as answers.

Textbox backcolour

4 Answers 92 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 06 Feb 2011, 06:11 PM
Hi,

I am new to radControls so this will most likely be something simple.

I have a textbox which I would like to change the backcolour but when I change the backcolour in the properties, nothing changes.

What am I missing?

Thanks

4 Answers, 1 is accepted

Sort by
0
Jay
Top achievements
Rank 1
answered on 06 Feb 2011, 09:50 PM
I found the solution :-)

((RadTextBoxItem)radTextBox1.RootElement.Children[0].Children[0]).BackColor = SystemColors.Control;
0
Richard Slade
Top achievements
Rank 2
answered on 06 Feb 2011, 10:08 PM
Hi Jay,

The easiest way to change the BackColor is as follows

this.radTextBox1.TextBoxElement.BackColor = SystemColors.Control;

Hope that helps
Richard
0
Nikolay
Telerik team
answered on 07 Feb 2011, 12:53 PM
Hello guys,

Richard, setting the color of the TextBoxElement will indeed do the job. However, if Jay wants to place this code line in the constructor of the Form which contains the textbox, the better solution is to actually set the BackColor of the TextBoxItem:
this.radTextBox1.TextBoxElement.TextBoxItem.BackColor = SystemColors.Control;

Jay, in addition to the code line given above, it will be nice to set the BackColor of the Fill as well. This will allow you to achieve a consistent look:
this.radTextBox1.TextBoxElement.Fill.BackColor = SystemColors.Control;

I hope this helps.

Greetings,
Nikolay
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
0
Richard Slade
Top achievements
Rank 2
answered on 07 Feb 2011, 12:56 PM
Thank you for correcting me about this Nikolay. That makes sense.
Regards,
Richard
Tags
TextBox
Asked by
Jay
Top achievements
Rank 1
Answers by
Jay
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Nikolay
Telerik team
Share this question
or