如何遍历color后面现有颜色?
如color.aliceblue,color.AntiqueWhite,我的意思是把aliceblue,antiquewhite等一个个列出来.

解决方案 »

  1.   


    using System.Reflection;     // 这个是文件头
    System.Drawing.Color color1 = new Color();
    //获取对象类型
    Type t = color1.GetType() ;
    //获取类的属性
    PropertyInfo[] propertys = t.GetProperties();foreach (System.Reflection.PropertyInfo pro in propertys)
    {
        MessageBox.Show (pro.Name);
    }
      

  2.   

    using System.Reflection;... Type t=typeof(System.Drawing.Color);
    PropertyInfo[] p=t.GetProperties();
    foreach (PropertyInfo i in p)
    {
    if (i.ToString().IndexOf("System.Drawing.Color") != -1)
    {
    Response.Write(i.ToString().Replace("System.Drawing.Color", "") + "</br>");
    }
    }...