zoukankan      html  css  js  c++  java
  • Table 控件使用示例

     protected void Table_Create()
            {
                //------------------------------------------------------------------
                TableRow tr;  //定义的表格的行
                TableCell tc; //定义表格的列
                int TrNum = 15; //行数
                int TcNum = 5;//列数
                Literal Lie1;
                for (int n = 0; n < TrNum;n++ )
                {
                    tr = new TableRow();
                    for (int v = 0; v < TcNum;)
                    {
                        tc = new TableCell();
                        Lie1 = new Literal();
                        tc.Width = Unit.Pixel(50);
                        Lie1.Text = "行" + n + "列" + v;
                        tc.Controls.Add(Lie1);
                        //tc.Controls.Add(new LiteralControl("行" + n + "列" + v));
                        tc.HorizontalAlign = HorizontalAlign.Center;
                        if(v%2==0)
                        {
                            tc.BackColor = Color.HotPink;
                        }
                        else
                        {
                            tc.BackColor = Color.Green;
                        }
                        tr.Cells.Add(tc);
                        tc.Attributes.Add("onclick", "alert('第" + n + "行" + ",第" + v + "列');");
                        v++;
                    }
                    Table2.Rows.Add(tr);
                    if(n%2==0)
                    {
                        tr.Attributes.Add("style", "page-break-after:always;BackColor:Back;");
                    }
                }
               
                Table2.Width = Unit.Pixel(560);
                Table2.BorderWidth = Unit.Pixel(1);
                Table2.BorderStyle = BorderStyle.Ridge;
                //Table2.Attributes.Add("onclick","return confirm('是否继续测试?');");
            }
  • 相关阅读:
    求解整数集合的交集(腾讯笔试)
    关于屏幕适配之比例布局
    (转)注册JNI函数的两种方式
    正则表达式记录
    当年一个简单可用的多线程断点续传类
    最近用到的几个工具方法
    Android中包含List成员变量的Parcel以及Parcel嵌套写法示例
    java实现计算MD5
    一个用于去除状态栏和虚拟导航栏的BaseActivity
    MVP的模板
  • 原文地址:https://www.cnblogs.com/ziyan22/p/909032.html
Copyright © 2011-2022 走看看