Private Sub RichTextBox1_Click(sender As Object, e As EventArgs) Handles RichTextBox1.Click
'计算光标所在的位置
Dim intSelstart As Integer
Dim intSelRow As Integer
Dim intSelColumn As Integer
Dim intPos As Integer
intSelstart = RichTextBox1.SelectionStart
intSelRow = RichTextBox1.GetLineFromCharIndex(intSelstart)
intSelColumn = intSelstart - RichTextBox1.GetFirstCharIndexFromLine(intSelRow)
intPos = intSelstart - intSelRow
Label1.Text = "光标位置 行号 : " & intSelRow + 1
Label1.Text = Label1.Text & ", 列号 : " & intSelColumn
Label1.Text = Label1.Text & ", 第 " & intPos & " 个字符处。"
End Sub
标签:VB,intSelRow,Label1,行和列,RichTextBox,RichTextBox1,Text,Integer,intSelstart From: https://www.cnblogs.com/LiYingPingNc/p/16747024.html