Dim txt As WinForm.TextBox = Forms("窗口1").Controls("TextBox1")
Dim a As Integer = txt.SelectionStart
Dim b As Integer = txt.SelectionStart + txt.SelectionLength
Dim idx As Integer = 0
For i As Integer = 0 To txt.Lines.Length - 1
idx += txt.Lines(i).Length + 2
If idx >= a Then
a = 99999
Output.Show("起始行=" & i + 1)
End If
If idx >= b Then
Output.Show("结束行=" & i + 1)
Exit For
End If
Next