表子边框没有以编程方式显示 [英] table roe border not displayed programmatically

查看:88
本文介绍了表子边框没有以编程方式显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
关于不显示table.row.border出现某种逻辑错误
这是我的代码

hi all
having some kind of logical error regarding not showing table.row.border
here is my code

Table mytable = new Table();
            for (int i = 0; i <= 9; i++) { 
            TableRow myrow = new TableRow();
            myrow.ID = "row" + i.ToString();
            for (int j = 0; j <= 3; j++) {
                TableCell mycell = new TableCell();
                mycell.ID = "cell"+i.ToString() + j.ToString();
                mycell.Text = "cell" + i.ToString() + j.ToString();
                //mycell.BorderWidth = 1;
                myrow.Cells.Add(mycell);
                
            }

            myrow.BorderWidth = 1;
                mytable.Rows.Add(myrow);
                
            }

            //mytable.BorderWidth = 1;
            form1.Controls.Add(mytable);


请看看这个
谢谢


please have a look in to this
thanks

推荐答案

尝试一下..工作正常


Try this..working fine


Table mytable = new Table();
        for (int i = 0; i <= 9; i++)
        {
            TableRow myrow = new TableRow();
            myrow.ID = "row" + i.ToString();
            for (int j = 0; j <= 3; j++)
            {
                TableCell mycell = new TableCell();
                mycell.ID = "cell" + i.ToString() + j.ToString();
                mycell.Text = "cell" + i.ToString() + j.ToString();
                //mycell.BorderWidth = 1;
                myrow.Cells.Add(mycell);
                mycell.BorderWidth = Unit.Point(2);
            }
            myrow.BorderWidth = 1;
            mytable.Rows.Add(myrow);
        }

        //mytable.BorderWidth = 1;
        frm.Controls.Add(mytable);


Table mytable = new Table();
            for (int i = 0; i <= 9; i++)
            {
                TableRow myrow = new TableRow();
                myrow.ID = "row" + i.ToString();
                for (int j = 0; j <= 3; j++)
                {
                    TableCell mycell = new TableCell();
                    mycell.ID = "cell" + i.ToString() + j.ToString();
                    mycell.Text = "cell" + i.ToString() + j.ToString();
                    mycell.BorderWidth = Unit.Point(2);
                    myrow.Cells.Add(mycell);

                }

                myrow.BorderWidth = 1;
                mytable.Rows.Add(myrow);

            }

            mytable.BorderWidth = Unit.Point(3);
            form1.Controls.Add(mytable);


通过单位传递边框宽度


pass border width with Unit



使用样式索引声明一个类
.rowStyle
{
边框:1px纯绿色;
}

并在添加单元格的同时添加样式
myrow.attributes.add("class","rowStyle");

谢谢:
购买蕾丝
Hi,
Declare a class using style index
.rowStyle
{
border:1px solid Green;
}

and add styles while adding the cells
myrow.attributes.add("class","rowStyle");

Thanks:
Buy Lace


这篇关于表子边框没有以编程方式显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆