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

Gray Backcolor in Inherited Textbox

6 Answers 163 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Eastern
Top achievements
Rank 1
Eastern asked on 09 Nov 2010, 01:35 PM
hello,

i make a user control and inherit it from RadTextBox , the problem is backcolor of my user control is gray instead of white.
i tried to change it via various methods ,but nothing worked till.

how can i solve this problem ?

6 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 09 Nov 2010, 01:43 PM
Hello Eastern,

To set the back color, you just need to get to the TextBoxElement. Please consider the following code:

Me.RadTextBox1.TextBoxElement.BackColor = Color.White

hope that helps
Richard
0
Eastern
Top achievements
Rank 1
answered on 09 Nov 2010, 02:56 PM
may i ask how can i change the border color of textbox in this inherited user control ?
default border color is somehow blue , i want to change it to red without messing with themes.

how can i do that ?
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 09 Nov 2010, 03:06 PM
Hi Eastern,

You can set the border color in this way..
DirectCast(Me.RadTextBox1.TextBoxElement.Children(2), Telerik.WinControls.Primitives.BorderPrimitive).ForeColor = Color.Black


You can view the element tree by using the smart tag and "Edit UI Elements"

Hope that helps
Richard
0
Eastern
Top achievements
Rank 1
answered on 09 Nov 2010, 04:55 PM
just another question ,

is there anyway that i can change only the bottom borderline color ?
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 09 Nov 2010, 05:24 PM
Hi Eastern,

I may be wrong, but as the border is being painted using the forecolor, it doesn't seem to behave as a normal border. I've found a workaround, though it's not ideal as it leaves a little of the border showing at the sides. Have a look at trying:

DirectCast(Me.RadTextBox1.TextBoxElement.Children(2), Telerik.WinControls.Primitives.BorderPrimitive).ForeColor = Color.Black
DirectCast(Me.RadTextBox1.TextBoxElement.Children(2), Telerik.WinControls.Primitives.BorderPrimitive).GradientStyle = Telerik.WinControls.GradientStyles.Linear

Let me know if that helps
Richard
0
Eastern
Top achievements
Rank 1
answered on 09 Nov 2010, 06:08 PM
Yeah, thanks man,
that was definitely what i was looking for ;)
Tags
TextBox
Asked by
Eastern
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Eastern
Top achievements
Rank 1
Share this question
or