Telerik blogs

Recently a question regarding how to change the BackColor of the RadMenu for WinForms. I thought it might be easier to outline this process with screenshots so I put together a quick post to answer the question. After creating a new WinForms application project, I added a RadMenu. The screenshot below shows that the default color of the menu is blue.


The quickest way to accomplish this task is to click on the SmartTag in the DesignView.  Then select the Edit UI Element menu option.



This will open a new window which is called the Element hierarchy editor.


Within the Element hierarchy editor, select the FillPrimitive entry at the bottom of the TreeView. You will see that the BackColor is actually a gradient which is managed by the BackColor, BackColor2, BackColor3 and BackColor4 properties. 


By changing the values in these properties you will now be able to modify the BackColor properties of the RadMenu gradient.


Click OK, to both the Color dialog and “Element hierarchy editor” and your RadMenu BackColor should now reflect your new color. 




This will generate the following code in the Form1.Designer.cs file.  So you could build the gradient yourself rather than walk through the process above, but it is better to know that both are available.

((Telerik.WinControls.Primitives.FillPrimitive)(this.radMenu1.GetChildAt(0).GetChildAt(1))).BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(189)))), ((int)(((byte)(191)))));


((Telerik.WinControls.Primitives.FillPrimitive)(this.radMenu1.GetChildAt(0).GetChildAt(1))).BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(189)))), ((int)(((byte)(192)))));

Note: You will need to repeat the process for the Telerik.WinControls.UI.RadMenuItem | FillPrimitive property in the Element hierarchy editor as well for the menu items to have the same gradient.

Related Posts


Comments are disabled in preview mode.