光标定位问题
如何动态实现将光标定位到表中的特定表格里? 回复 1楼dodo的帖子示例代码如下:
private void Form1_Load(object sender, EventArgs e)
{
this.textControl1.Tables.Add(10,10,11);
}
private void activeCellToolStripMenuItem_Click(object sender, EventArgs e)
{
TXTextControl.Table tb = this.textControl1.Tables.GetItem(11);
foreach (TXTextControl.TableCell cell in tb.Cells)
{
if (cell.Row==2&&cell.Column==2)
{
cell.Select();
}
}
}
我用的是ACtive 版本,没有发现有cell.Select()函数或类似功能函数 回复 3楼dodo的帖子
下面是 TX ActiveX 针对 Table 操作的示例代码:
'
//选择 table
Private Sub SelectTable(tx As TXTextControl)
With tx
.SelStart = .TableCellStart(.TableAtInputPos, 1, 1) - 1
.SelLength = .TableCellStart(.TableAtInputPos, .TableRows(.TableAtInputPos), .TableColumns(.TableAtInputPos)) + _
.TableCellLength(.TableAtInputPos, .TableRows(.TableAtInputPos), .TableColumns(.TableAtInputPos)) + _
-.SelStart - 1
End With
End Sub
//选择 row
Private Sub SelectTableRow(tx As TXTextControl)
With tx
.SelStart = .TableCellStart(.TableAtInputPos, .TableRowAtInputPos, 1) - 1
.SelLength = .TableCellStart(.TableAtInputPos, .TableRowAtInputPos, .TableColumns(.TableAtInputPos)) + _
.TableCellLength(.TableAtInputPos, .TableRowAtInputPos, .TableColumns(.TableAtInputPos)) + _
-.SelStart - 1
End With
End Sub
//选择 col
Private Sub SelectTableColumn(tx As TXTextControl)
With tx
.SelStart = .TableCellStart(.TableAtInputPos, 1, .TableColAtInputPos) - 1
.SelLength = .TableCellStart(.TableAtInputPos, .TableColumns(.TableAtInputPos), .TableColAtInputPos) + _
.TableCellLength(.TableAtInputPos, .TableColumns(.TableAtInputPos), .TableColAtInputPos) + _
-.SelStart - 1
End With
End Sub
//选择 cell
Private Sub SelectTableCell(tx As TXTextControl)
With tx
.SelStart = .TableCellStart(.TableAtInputPos, .TableRowAtInputPos, .TableColAtInputPos) - 1
.SelLength = .TableCellLength(.TableAtInputPos, .TableRowAtInputPos, .TableColAtInputPos)
End With
End Sub
页:
[1]