Changing TitleBar colour of a RadForm

4 posts, 1 answers
  1. Shaun
    Shaun avatar
    37 posts
    Member since:
    Sep 2012

    Posted 19 Sep 2012 Link to this post


    I'm in the process of evaluating your winform controls and I'm trying to emulate the way the demo app hub changes the title bar of a form, size and colour. For example when selecting the Grid Example the header is about 80 high, dark blue with a back button.

    The app I created has a simple Radform and Rad Data View, on load I try to change the TitleBar, but I must be doing something wrong.
    I can change the background colour but the background of the system buttons stay the same.

    Here's a snippet 
               this.FormElement.TitleBar.Size = new System.Drawing.Size(this.Width, 100);
                this.FormElement.TitleBar.FillPrimitive.BackColor = Color.DarkBlue;
                this.FormElement.TitleBar.CloseButton.ImagePrimitive.BackColor =  Color.Transparent;

    I has also tried to create a new RadTitleBarElement, but the out come is the same.

    I know I'm missing something simple here so can you point me in the right direction?


  2. Answer
    Nikolay avatar
    1802 posts

    Posted 20 Sep 2012 Link to this post

    Hi Shaun,

    Thank you the question.

    The minimize/maximize/close buttons are controlled by images, so regardless of the color setting that you apply, you are again observing the same style and behavior. You can edit the buttons states removing the images by using our Visual Style Builder tool. Here you can read more about loading our predefined themes in case you want to start from an existing theme.

    Alternatively, if you are happy with the images that appear by default when the mouse is not over and not down on the buttons, you can override the MouseOver and MouseDown images set by theme by explicitly setting the default image in code like this:

    this.FormElement.TitleBar.CloseButton.ImagePrimitive.Image = this.FormElement.TitleBar.CloseButton.ImagePrimitive.Image;

    In addition, you might want to set the border to the same DarkBlue color as the fill. Moreover, in order to increase the height of the titlebar, I would recommend setting its Padding to an appropriate value:
    this.FormElement.TitleBar.Padding = new Padding(0, 50, 0, 50);
    this.FormElement.TitleBar.FillPrimitive.BackColor = Color.DarkBlue;
    this.FormElement.TitleBar.FillPrimitive.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
    this.FormElement.TitleBar.BorderPrimitive.BoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder;
    this.FormElement.TitleBar.BorderPrimitive.ForeColor = Color.DarkBlue;

    I hope this helps. Let me know if you need additional assistance.

    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. DevCraft R3 2016 release webinar banner
  4. Muhammad
    Muhammad avatar
    1 posts
    Member since:
    Sep 2016

    Posted 30 Sep in reply to Nikolay Link to this post

    hi shaun 

    thankyou for the answer 

    but i have a question about radTitleBar 

    how i can change its background colour

    default is gray but i want to set its colour blue


  5. Dess
    Dess avatar
    1562 posts

    Posted 04 Oct Link to this post

    Hello Muhammad,

    Thank you for writing.  

    In order to change the back color for RadTitleBar, you can use the following code snippet:
    1.this.radTitleBar1.TitleBarElement.TitleBarFill.BackColor = Color.Yellow;
    2.this.radTitleBar1.TitleBarElement.TitleBarFill.GradientStyle = Telerik.WinControls.GradientStyles.Solid;

    I hope this information helps. Should you have further questions I would be glad to help.

    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Back to Top