修改后,可以使用了。- private void Form1_Load(object sender, EventArgs e)
- {
- int tableID = 10;
- textControl1.Tables.Add(3, 1, tableID);
- TXTextControl.Table table = textControl1.Tables.GetItem(tableID);
- table.Cells.GetItem(1, 1).Text = "主诉:右肩关节上举疼痛7天。";
- }
- private void button1_Click(object sender, EventArgs e)
- {
- int position = 0;
- this.textControl1.InputPosition = new InputPosition(position);
- position = this.textControl1.Find("主诉") + 3;
- this.textControl1.Selection.Start = position;
- int row = -1;
- for (int i = 1; i < this.textControl1.Tables.GetItem(10).Rows.Count - 1; i++)
- {
- if (this.textControl1.Tables.GetItem(10).Cells.GetItem(i, 1).Text.StartsWith("主诉"))
- {
- row = i;
- break;
- }
- }
- this.textControl1.Selection.Length = this.textControl1.Tables.GetItem(10).Cells.GetItem(row, 1).Text.Length
- - position;
- this.textControl1.Selection.Text = "替换";
- }
复制代码 |