ZenosZeng 发表于 2011-7-13 13:37:00

通过以下代码可以实现该功能:

      int id = 1000;
      private void btnInsertTable_Click(object sender, EventArgs e)
      {
            this.textControl1.Tables.Add(2, 3, id);
            this.textControl1.Tables.GetItem(id).Select();
            this.textControl1.TableFormatDialog();
            id++;
      }

jxf16888 发表于 2011-7-13 16:37:00

非常感谢你,你这个方法是可以选择上自己了!现在又出现一个新的问题,用户设置完成后,光标怎么还在那个表格中的第一个表格中的,怎么能让光标如插入后自动停的位置?

执行this.textControl1.TableFormatDialog();这个后
怎么让光标自动到新创建表格的下一行?

ZenosZeng 发表于 2011-7-13 20:41:00


      int id = 1000;
      private void btnInsertTable_Click(object sender, EventArgs e)
      {
            int rowcount, colcount,txtposition;

            rowcount = 2;
            colcount = 3;
            txtposition = this.textControl1.InputPosition.TextPosition;

            this.textControl1.Tables.Add(2, 3, id);
            this.textControl1.Tables.GetItem(id++).Select();
            this.textControl1.TableFormatDialog();            
            this.textControl1.Focus();
            this.textControl1.InputPosition = new InputPosition(txtposition + rowcount * colcount + 1);
      }

jxf16888 发表于 2011-7-15 08:59:00

谢谢,这次好了!

ZenosZeng 发表于 2011-7-15 09:04:00

思路就是设置InputPosition,你也可以根据你的需求来设置其具体位置。

lisve2010 发表于 2011-12-1 11:23:00

哈正好我也在找 嘿嘿

lisve2010 发表于 2011-12-1 11:32:00

回复 11# dof 的帖子

:~我的怎么报错了啊this.textControl1.TableFormatDialog();就是在这一句除了这几句代码 还要添加别的什么吗?

ZenosZeng 发表于 2011-12-1 15:14:00

你可以将先注释掉,确定Table是不是被选中了。
      int id = 1000;
      private void btnInsertTable_Click(object sender, EventArgs e)
      {
            this.textControl1.Tables.Add(2, 3, id);
            this.textControl1.Tables.GetItem(id).Select();
            //this.textControl1.TableFormatDialog();
            id++;
      }

lisve2010 发表于 2011-12-1 15:44:00

file:///E:/pig1.jpg这个确实是 有的呐:~

lisve2010 发表于 2011-12-1 15:46:00

晕 图片呢?
页: 1 [2] 3
查看完整版本: 怎么在新建表格后自己选择中?