Textbox backcolour

5 posts, 0 answers
  1. Jay
    Jay avatar
    3 posts
    Member since:
    Jan 2011

    Posted 06 Feb 2011 Link to this post

    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
  2. Jay
    Jay avatar
    3 posts
    Member since:
    Jan 2011

    Posted 06 Feb 2011 Link to this post

    I found the solution :-)

    ((RadTextBoxItem)radTextBox1.RootElement.Children[0].Children[0]).BackColor = SystemColors.Control;
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 06 Feb 2011 Link to this post

    Hi Jay,

    The easiest way to change the BackColor is as follows

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

    Hope that helps
    Richard
  5. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 07 Feb 2011 Link to this post

    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.
  6. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 07 Feb 2011 Link to this post

    Thank you for correcting me about this Nikolay. That makes sense.
    Regards,
    Richard
Back to Top
UI for WinForms is Visual Studio 2017 Ready