zoukankan      html  css  js  c++  java
  • Color类 通过反射将Color中定义的颜色输出

    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());
    }

    //输出如图

    没有目标的人都只在帮有目标的人完成目标

  • 相关阅读:
    Dom修改元素样式
    URL百分号编码
    accesskey附上一些实例
    dom实例
    dom 创建时间
    关系运算符
    赋值运算符
    js图片随机切换
    js自增图片切换
    transform-origin盒子旋转位置
  • 原文地址:https://www.cnblogs.com/tweet/p/1647929.html
Copyright © 2011-2022 走看看