试试以下代码!!!!!!Public Sub Get_Line()
Dim lLineCount As Long, lLineIndex As Long, lCurrentByte As Long, i As Long, J As Long
Dim lColNo As Long, lLineLength As Integer
With FrmMain.RichEdit(0)
lLineCount = SendMessage(.hwnd, EM_GETLINECOUNT, ByVal 0&, .SelStart)
lLineIndex = .GetLineFromChar(.SelStart) + 1
lCurrentByte = SendMessage(.hwnd, EM_LINEINDEX, -1, 0) '取得目前光标所在行前面有多少个Byte
lLineLength = SendMessage(.hwnd, EM_LINELENGTH, lCurrentByte, 0) + 1 '取得当前行的长度
i = SendMessage(.hwnd, EM_GETSEL, ByVal 0&, ByVal 0&)
J = i / 65536 '取得目前光标所在位置前有多少个Byte
lColNo = J - lCurrentByte + 1
End With
With FrmMain.StatusBar1
.Panels(2) = "行:" & lLineIndex & " / " & lLineCount
.Panels(3) = "列:" & lColNo & " / " & lLineLength
End With
End Sub
Dim lLineCount As Long, lLineIndex As Long, lCurrentByte As Long, i As Long, J As Long
Dim lColNo As Long, lLineLength As Integer
With FrmMain.RichEdit(0)
lLineCount = SendMessage(.hwnd, EM_GETLINECOUNT, ByVal 0&, .SelStart)
lLineIndex = .GetLineFromChar(.SelStart) + 1
lCurrentByte = SendMessage(.hwnd, EM_LINEINDEX, -1, 0) '取得目前光标所在行前面有多少个Byte
lLineLength = SendMessage(.hwnd, EM_LINELENGTH, lCurrentByte, 0) + 1 '取得当前行的长度
i = SendMessage(.hwnd, EM_GETSEL, ByVal 0&, ByVal 0&)
J = i / 65536 '取得目前光标所在位置前有多少个Byte
lColNo = J - lCurrentByte + 1
End With
With FrmMain.StatusBar1
.Panels(2) = "行:" & lLineIndex & " / " & lLineCount
.Panels(3) = "列:" & lColNo & " / " & lLineLength
End With
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货