📄 17653.html
字号:
<html> <head> <title>Thanks your help, I have another method for this problem ! (有兴趣请入内)</title> </head> <body bgcolor="#FFFFFF" vlink="#808080"> <center> <h1>Thanks your help, I have another method for this problem ! (有兴趣请入内)</h1> </center><hr size=7 width=75%><hr size=7 width=75%><p>Posted by Albert on August 21, 1999 at 11:30:13:<p>In Reply to: <a href="17620.html">Re: 请问: 如何得知 目前由标是停在 TextBox 的第几行 ? (无内文) Thanks much !!!</a> posted by 小琳 on August 20, 1999 at 20:33:36:<p>我参考 http://www.hosp.ncku.edu.tw/~cww/ 中的程式<p><br>Option Explicit<br>Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long<p>' 以上加在 .bas 档<br>'============================================<p>Const EM_GETLINE = &HC4<br>Const EM_GETLINECOUNT = &HBA<br>Const EM_LINEFROMCHAR = &HC9<br>Const EM_GETSEL = &HB0<br>Const EM_LINEINDEX = &HBB<p>Public Function GetLinePos(Text1 As TextBox)<br>Dim lcnt As Long<br>Dim i As Long<br>Dim j As Long<p> i = SendMessage(Text1.hwnd, EM_GETSEL, wParam, lParam)<br> j = i / 2 ^ 16 '取得目前 Caret 所在前面有多少个byte<br> GetLinePos = SendMessage(Text1.hwnd, EM_LINEFROMCHAR, j, 0) '取得前面有多少行<br> <br>End Function<br><br><hr size=7 width=75%><p><a name="followups">Follow Ups:</a><br><ul><!--insert: 17653--></ul><!--end: 17653--><br><hr size=7 width=75%><p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -