using System.Drawing;
using System.Reflection;
using System.Text;
protected void Page_Load(object sender, EventArgs e)
{
//以Color 对象为例 输出所有定义的属性颜色
Type t = typeof(Color);
PropertyInfo[] properties = t.GetProperties(BindingFlags.Static | BindingFlags.Public);
StringBuilder sb = new StringBuilder();
int i = 0;
foreach (PropertyInfo info in properties)
{
sb.AppendFormat("<span style='background-color:{0};140px;border:2px solid #336699; margin:5px; line-height:30px; text-align:center; vertical-align:middle'>{0}</span>", info.Name);
i++;
//每行显示9个.
if (i % 9 == 0)
{
sb.Append("<br/>");
}
}
Response.Write(sb.ToString());
}
//输出如图