Modifying the BackColor of a Panel

2 posts, 0 answers
  1. Kirk Martin
    Kirk Martin avatar
    3 posts
    Member since:
    Oct 2009

    Posted 05 Dec 2009 Link to this post

    Hi.... I am trying to modify the "FillPrimitive" values for a RadPanel using VB.Net Code.  I will admit that I am new to VB.Net and Telerik products.  I currently have installed the demo for WinForms Q3 2009 installed, and am currently going thu a tutorial posed here on this site that references the FormElement.ClientFillPrimitive for a form.  I read the release notes that said I should use a panel in the form to accomplish the same functionality.  I however have not been able to access the FillPrimitive properties for the Panel from code.  I can do so using the smart tag editor... but not from code.

    Any help would be appreciated
    Thank you
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 07 Dec 2009 Link to this post

    Hello Kirk Martin,

    Thank you for the question.

    The controls are built on a hierarchy of elements. This hierarchy could be iterated with the help of the Children collection of an element. In you case you can access the FillPrimitive using this code snippet:

    DirectCast(Me.RadPanel1.PanelElement.Children(0), FillPrimitive).BackColor = Color.Red
    DirectCast(Me.RadPanel1.PanelElement.Children(0), FillPrimitive).BackColor2 = Color.Orange
    DirectCast(Me.RadPanel1.PanelElement.Children(0), FillPrimitive).BackColor3 = Color.Green
    DirectCast(Me.RadPanel1.PanelElement.Children(0), FillPrimitive).BackColor4 = Color.Blue
    DirectCast(Me.RadPanel1.PanelElement.Children(0), FillPrimitive).NumberOfColors = 4

    The hierarchy of elements could be inspected with the help of the Element Hierarchy Editor tool.

    I hope this helps. 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.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top