VB文本框获取行数的问题
我用下面的代码来获取文本框内容的行数,但是有一个问题,当每行的文字长度超过文本框的宽度时,就会被算作2行,我只想用向下滚动条,不想用左右滚动条,请问那位高人可以帮忙解决一...
我用下面的代码来获取文本框内容的行数,但是有一个问题,当每行的文字长度超过文本框的宽度时,就会被算作2行,我只想用向下滚动条,不想用左右滚动条,请问那位高人可以帮忙解决一下。
代码如下:
Const EM_GETLINECOUNT = 186
Private Declare Function SendMessageAsLong Lib "user32" _
Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Sub Text1_Change()
Dim lCount As Long
lCount = SendMessageAsLong(Text1.hWnd, EM_GETLINECOUNT, 0, 0)
Label1.Caption = "Rows:" & lCount
End Sub 展开
代码如下:
Const EM_GETLINECOUNT = 186
Private Declare Function SendMessageAsLong Lib "user32" _
Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Sub Text1_Change()
Dim lCount As Long
lCount = SendMessageAsLong(Text1.hWnd, EM_GETLINECOUNT, 0, 0)
Label1.Caption = "Rows:" & lCount
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询