17653.html
来自「以电子书的形式收集了VB一些常见问题解决方法,可以很方便的查找自己需要解决的问题」· HTML 代码 · 共 23 行
HTML
23 行
<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 + =
减小字号Ctrl + -
显示快捷键?