Private Sub RichTextBox1_SelChange()
'Показать номер строки через GetLineFromChar
DoEvents
Static Stlb as Long, Lnx as Long
Stlb = RichTextBox1.SelStart
Lnx = RichTextBox1.GetLineFromChar(Stlb) + 1
MsgBox "Строка " & Trim(Str(Lnx))
End Sub
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_LINEFROMCHAR = &HC9
Private Const EM_LINEINDEX = &HBB
Private Const EM_LINELENGTH = &HC1
Public Sub GetEditStatus()
Dim lLine As Long, lCol As Long
Dim cCol As Long, lChar As Long, I As Long
lChar = RichTextBox1.SelStart + 1
' Номер строки
lLine = 1 + SendMessageLong(RichTextBox1.hWnd, EM_LINEFROMCHAR, _
RichTxtBox.SelStart, 0&)
' Позиция курсора
cCol = SendMessageLong(RichTxtBox1.hWnd, EM_LINELENGTH, lChar - 1, 0&)
I = SendMessageLong(RichTxtBox1.hWnd, EM_LINEINDEX, lLine - 1, 0&)
lCol = lChar - I
MsgBox "Строка: " & lLine & ", Столбец: " & lCol
End Sub
hCORe писал(а):Не забудь сказать спасибо папочке
Сейчас этот форум просматривают: AhrefsBot и гости: 66