首页 > 代码库 > Silverlight 设置颜色
Silverlight 设置颜色
透明色:00ff00ff
//设置柱状图的颜色
ColorSet cs = new ColorSet();
cs.Id = "colorset1";
#region 设置柱状图的颜色 待开发
string strColor = oYAXIS.Color;
switch (strColor)
{
case "Red":
cs.Brushes.Add(new SolidColorBrush(Color.FromArgb(0xff, 0xff, 0x45, 0x00))); //#FFFF4500 orangeRed
break;
case "Yellow":
cs.Brushes.Add(new SolidColorBrush(Color.FromArgb(0xff, 0xda, 0xa5, 0x20)));//FFDAA520 Goldenrod
break;
case "Orange":
cs.Brushes.Add(new SolidColorBrush(Colors.Orange));
break;
case "Green":
cs.Brushes.Add(new SolidColorBrush(Colors.Green));
break;
case "Blue":
cs.Brushes.Add(new SolidColorBrush(Color.FromArgb(0xff, 0x41, 0x69, 0xe1))); //FF4169E1 RoyalBlue
break;
case "White":
cs.Brushes.Add(new SolidColorBrush(Color.FromArgb(0xff, 0xff, 0xff, 0xff))); //FFFFFFFF RoyalBlue Color.FromArgb(0xff, 0xff, 0xff, 0xff) 透明色;00ff00ff
break;
default:
break;
}
#endregion
#region 设置 Chart 使用自定义的颜色集合 colorset1
if (cs.Brushes.Count > 0)
{
chart.ColorSets.Clear();
chart.ColorSets.Add(cs);
chart.ColorSet = "colorset1";
}
# endregion