找回密码
 立即注册

QQ登录

只需一步,快速开始

dodo

银牌会员

8

主题

22

帖子

2134

积分

银牌会员

积分
2134

活字格认证

[已处理] 光标定位问题

dodo
银牌会员   /  发表于:2012-10-18 10:57  /   查看:6234  /  回复:3
如何动态实现将光标定位到表中的特定表格里?

3 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2012-10-18 15:50:00
沙发
回复 1楼dodo的帖子

示例代码如下:

  1. private void Form1_Load(object sender, EventArgs e)
  2.         {
  3.             this.textControl1.Tables.Add(10,10,11);
  4.         }

  5.         private void activeCellToolStripMenuItem_Click(object sender, EventArgs e)
  6.         {
  7.             TXTextControl.Table tb = this.textControl1.Tables.GetItem(11);
  8.             foreach (TXTextControl.TableCell cell in tb.Cells)
  9.             {
  10.                 if (cell.Row==2&&cell.Column==2)
  11.                 {
  12.                     cell.Select();
  13.                 }
  14.             }
  15.         }
复制代码
回复 使用道具 举报
dodo
银牌会员   /  发表于:2012-10-19 09:15:00
板凳
我用的是ACtive 版本,没有发现有cell.Select()函数或类似功能函数
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-10-19 18:03:00
地板
回复 3楼dodo的帖子

下面是 TX ActiveX 针对 Table 操作的示例代码:
  1. '

  2. //选择 table
  3. Private Sub SelectTable(tx As TXTextControl)
  4.     With tx
  5.         .SelStart = .TableCellStart(.TableAtInputPos, 1, 1) - 1
  6.         .SelLength = .TableCellStart(.TableAtInputPos, .TableRows(.TableAtInputPos), .TableColumns(.TableAtInputPos)) + _
  7.             .TableCellLength(.TableAtInputPos, .TableRows(.TableAtInputPos), .TableColumns(.TableAtInputPos)) + _
  8.             -.SelStart - 1
  9.     End With
  10. End Sub
  11. //选择 row
  12. Private Sub SelectTableRow(tx As TXTextControl)
  13.     With tx
  14.         .SelStart = .TableCellStart(.TableAtInputPos, .TableRowAtInputPos, 1) - 1
  15.         .SelLength = .TableCellStart(.TableAtInputPos, .TableRowAtInputPos, .TableColumns(.TableAtInputPos)) + _
  16.             .TableCellLength(.TableAtInputPos, .TableRowAtInputPos, .TableColumns(.TableAtInputPos)) + _
  17.             -.SelStart - 1
  18.     End With
  19. End Sub
  20. //选择 col
  21. Private Sub SelectTableColumn(tx As TXTextControl)
  22.     With tx
  23.         .SelStart = .TableCellStart(.TableAtInputPos, 1, .TableColAtInputPos) - 1
  24.         .SelLength = .TableCellStart(.TableAtInputPos, .TableColumns(.TableAtInputPos), .TableColAtInputPos) + _
  25.             .TableCellLength(.TableAtInputPos, .TableColumns(.TableAtInputPos), .TableColAtInputPos) + _
  26.             -.SelStart - 1
  27.     End With
  28. End Sub
  29. //选择 cell
  30. Private Sub SelectTableCell(tx As TXTextControl)
  31.     With tx
  32.         .SelStart = .TableCellStart(.TableAtInputPos, .TableRowAtInputPos, .TableColAtInputPos) - 1
  33.         .SelLength = .TableCellLength(.TableAtInputPos, .TableRowAtInputPos, .TableColAtInputPos)
  34.     End With
  35. End Sub
复制代码
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部