远光软件 发表于 2015-8-14 15:47:00

插入带格式表格 100行*10列(性能低),如何处理

插入带格式表格(性能低:
代码片段
"private void cmdOK_Click(object sender, System.EventArgs e)
      {
            DateTime dtStart = DateTime.Now;
            int newTableID = 10 + tx.Tables.Count;
            int rows = (int)updownRows.Value;
            int columns = (int)updownColumns.Value;
            this.tx.Tables.Add(rows, columns, newTableID);         
            this.SetTableDefaultFormat(newTableID);          // 设置表格的默认格式         
            this.DialogResult = DialogResult.OK;
            this.Close();
      }
private void SetTableBorderWidthTextDistance(Table table)
      {
            tx.SuspendLayout();
            foreach (TableCell cell in table.Cells)
            {
               cell.CellFormat.TopBorderWidth =15; //0.75pt
               cell.CellFormat.BottomBorderWidth =15; //0.75pt
               cell.CellFormat.LeftBorderWidth =15; //0.75pt
               cell.CellFormat.RightBorderWidth =15; //0.75pt
               
                cell.CellFormat.TopTextDistance = cell.CellFormat.BottomTextDistance =
                  cell.CellFormat.LeftTextDistance = cell.CellFormat.RightTextDistance = 30;

                cell.CellFormat.TopBorderColor = cell.CellFormat.BottomBorderColor =
                  cell.CellFormat.LeftBorderColor = cell.CellFormat.RightBorderColor = Color.Black;
            }
            tx.ResumeLayout();
      }"

iceman 发表于 2015-8-14 17:08:00

回复 1楼远光软件的帖子

问题已经重现了,我会发送给厂商,询问是否有什么优化方法。
收到反馈后第一时间通知你。

iceman 发表于 2015-8-21 11:54:00

回复 1楼远光软件的帖子

由于目前没有直接有效的减少性能消耗的办法,建议您分批进行表格的创建和格式化:
1.在 ServerTextControl 中创建10×10行列并格式化
2.添加到 TextControl 中
3.重复1、2步骤直至完成表格添加。

远光软件 发表于 2015-8-24 08:49:00

我要的是 一个表格 100行* 10列,而不是10*10 的多个表格,能实现吗,最好给个demo

Alice 发表于 2015-8-24 16:14:00

回复 4楼远光软件的帖子

很抱歉给你带来的不便。
目前没有已经实现的示例。
基本思路请参考3楼所示的步骤,它是通过创建少的行列并多次重复实现。

iceman 发表于 2015-9-2 09:22:00

回复 4楼远光软件的帖子

为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢
http://gcdn.gcpowertools.com.cn/attachment.aspx?attachmentid=10062
页: [1]
查看完整版本: 插入带格式表格 100行*10列(性能低),如何处理