change backcolor of a form

7 posts, 1 answers
  1. appdev
    appdev avatar
    223 posts
    Member since:
    Sep 2008

    Posted 10 Feb 2009 Link to this post

     

    Private Sub Login_Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

     

     

    Me.BackColor = Color.Silver

     

    ThemeResolutionService.ApplicationThemeName =

    "Aqua"

     

     

    End Sub

    the backcolor doesn't change. it stays white all the time. how do i do this? please hlep thank you

     

  2. Answer
    Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 13 Feb 2009 Link to this post

    Hello Duy,

    Thank you for the question.

    The background color of RadForm is governed by the ClientFillPrimitive. Please refer to the following code snippet:
            Me.BackColor = Color.Silver  
            Me.FormElement.ClientFillPrimitive.BackColor = Color.Silver  
            Me.FormElement.ClientFillPrimitive.NumberOfColors = 1  
            ThemeResolutionService.ApplicationThemeName = "Aqua" 

    Note that I am setting the BackColor property of the RadForm as well. This is in case that there are controls which do not have their BackColor property explicitly set. Since the BackColor is an ambient property, these controls will get the BackColor value of their parent, i.e. the RadForm.BackColor.

    If you have additional questions, feel free to contact me.

    Sincerely yours,
    Nikolay
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. kottu
    kottu avatar
    23 posts
    Member since:
    Mar 2009

    Posted 20 Jul 2009 Link to this post

    thanks Nikolay ,


    regards,
     vicky


  5. Alexandre
    Alexandre avatar
    10 posts
    Member since:
    May 2009

    Posted 13 Sep 2009 Link to this post

    Hi Nikolay, I'm a new user of Telerik, I bought the library a few days, I read the post and I'm follow ORM Tutorial and that there's a code to change color of RadForm like bellow:

    this.FormElement.ClientFillPrimitive.BackColor =
    Color.FromArgb(159, 159, 159);
    this.FormElement.ClientFillPrimitive.BackColor2 =
    Color.FromArgb(120, 120, 120);
    this.FormElement.ClientFillPrimitive.BackColor3 =
    Color.FromArgb(110, 110, 110);
    this.FormElement.ClientFillPrimitive.GradientStyle =
    GradientStyles.OfficeGlassRect;

    but this don't compile, so reading the post i change the fist line to this.BackColor and work's fine, but how can I create the effect where can I find BackColor2 and BackColor3 ?

    Thanks.



  6. Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 14 Sep 2009 Link to this post

    Hello Alexandre,

    Thanks for contacting us and for your question. The code snippet that you found is not relevant to the latest version of RadControls for WinForms since the RadForm control has been rewritten from scratch and its element hierarchy has also been changed.

    As you have already find out, you can change the background color of the form by using the BackColor property. However, if you would like to achieve a Gradient effect consisting of multiple colors, you could use a RadPanel control docked to fill the client area of the form. You can take a look at the following help article as a reference on how to build a gradient filled panel:

    Creating a RadPanel with Gradient Background

    After you have docked the panel to fill the client area of your form, you can drop your controls on it the same way as you would on a normal RadForm.

    I hope this helps. Do not hesitate to write back if you need further assistance.

    All the best,
    Deyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Bruce
    Bruce avatar
    4 posts
    Member since:
    Jun 2010

    Posted 28 Feb 2011 Link to this post

    RE: "The code snippet that you found is not relevant to the latest version of RadControls for WinForms since the RadForm control has been rewritten from scratch and its element hierarchy has also been changed."

    Then please update the tutorial!  I'm trying to evaluate your product, and these repeated references to the tutorial not matching your latest release is a bit maddening.
  8. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 28 Feb 2011 Link to this post

    Hello Bruce,

    Thank you for your feedback.

    We are currently in the process of updating our step-by-step tutorial according to the API of the latest version of RadControls for WinForms. The updated tutorial will be released shortly after Q1 2010. Please accept our appologies for the inconvenience. For the time being, you can follow the RadForm articles from our online documentation.

    Kind regards,
    Nikolay
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top
UI for WinForms is Visual Studio 2017 Ready