第1个回答 2013-04-15
public Color col(string colorName)
{
Type colorType = typeof(Color);
PropertyInfo info = colorType.GetProperty(colorName, BindingFlags.Public | BindingFlags.Static);
if (infos == null)
{
//throw Exception
}
return(Color)info.GetValue(null, null);
}
是这个意思么?输入“Red”, 返回Color.Red 区分大小写本回答被提问者采纳