2017-08-03 27 views
-3

如何更改Telerik RadButton背景色?如何更改Telerik RadButton背景色与c#

Screenshot example buttons

你可以改变背景色或前景色为System.Windows.Forms.Button,但它不是Telerik.WinControls.UI.RadButton工作。

Telerik.WinControls.UI.RadDropDownButton

由于

+0

如果我没有记错的话,你应该重写默认主题。也许将'EnableTheming'属性设置为'false'。尝试在官方telerik页面上找到一些教程。 – Nino

+0

@Nino我试过'EnableTheming = false;'不工作。 – aghilpro

回答

0

的Telerik的radbutton的背景相同的问题是由fill primitive限定。 要更改其属性,请打开Edit UI Elements,FillPrimitive并更改BackColor属性。

更改背面颜色与代码:

using Telerik.WinControls.Primitives; 

((FillPrimitive)radButton1.ButtonElement.GetChildrenByType(typeof(FillPrimitive))[0]).BackColor = Color.FromArgb(241, 241, 231); 
((FillPrimitive)radButton1.ButtonElement.GetChildrenByType(typeof(FillPrimitive))[0]).BackColor2 = Color.FromArgb(227, 227, 212); 
((FillPrimitive)radButton1.ButtonElement.GetChildrenByType(typeof(FillPrimitive))[0]).BackColor3 = Color.FromArgb(209, 208, 187); 

((FillPrimitive)radButton1.ButtonElement.GetChildrenByType(typeof运算(FillPrimitive))[0])= BackColor4 Color.FromArgb(229,229,213);

您还可以使用FillPrimitiveNumberOfColors属性修改渐变中的颜色数。

Screenshot

请记住,应用背景色一样,将覆盖从Telerik的主题来任意设置背景色。