xiaozhu 发表于 2017-7-27 09:54:06

Textcontrol for WPF表格边框线的显示设置问题

插入表后,表格边框默认是None(即全不显示),需要将其默认显示为All(即全显示)。怎么设置。
另外:
      private void MenuTable_Insert_Table_Click(object sender, RoutedEventArgs e)
      {
            if (_textControl.Tables.Add())
            {
                _fileHandler.DocumentDirty = true;
                var cells = (_textControl.Tables.GetEnumerator().Current as TXTextControl.Table).Cells;
                foreach (TXTextControl.TableCell x in cells)
                {
                  TXTextControl.TableCellFormat myCellFormat = new TXTextControl.TableCellFormat();
                  myCellFormat.LeftBorderWidth = 500;
                  myCellFormat.RightBorderWidth = 50;
                  myCellFormat.TopBorderWidth = 50;
                  myCellFormat.BottomBorderWidth = 50;
                  myCellFormat.VerticalAlignment = TXTextControl.VerticalAlignment.Center;
                  
                  x.CellFormat = myCellFormat;
                  
                }
            }
      }

断点表明程序已经执行,但设置不起作用。

Richard.Ma 发表于 2017-7-27 16:57:28

按照文档确实是这样设置的。我这边测试过了,这样设置确实没有效果,这个问题我帮你向厂商确认一下看看,可能需要一天的时间。

xiaozhu 发表于 2017-8-16 11:05:48

还是没有办法吗?我只是想插入表格的时候默认边框有实线而已,难道这都办不到?

Richard.Ma 发表于 2017-8-17 10:51:13

xiaozhu 发表于 2017-8-16 11:05
还是没有办法吗?我只是想插入表格的时候默认边框有实线而已,难道这都办不到?

厂商一直没有回复,我是自己又帮你研究了下,找到了原因,应该是枚举器的原因
Table tb = (Table)_textControl.Tables.GetItem(0);
            tb.Cells.GetItem(1, 1).Text="22";
            tb.Cells.GetItem(1, 1).CellFormat = new TableCellFormat() {
                BackColor=Color.AliceBlue,
                LeftBorderColor = Color.Red,
                TopBorderColor = Color.Red,
                BottomBorderColor = Color.Red,
                RightBorderColor = Color.Red,

                LeftBorderWidth = 1,
                TopBorderWidth = 1,
                RightBorderWidth = 1,
                BottomBorderWidth = 1

            };
            tb.Rows.GetItem(3).CellFormat = new TableCellFormat()
            {
                LeftBorderColor = Color.Black,
                TopBorderColor = Color.Black,
                BottomBorderColor = Color.Black,
                RightBorderColor = Color.Black,

                LeftBorderWidth = 1,
                TopBorderWidth = 1,
                RightBorderWidth = 1,
                BottomBorderWidth = 1
            };
页: [1]
查看完整版本: Textcontrol for WPF表格边框线的显示设置问题