Option Explicit
Public Declare Function SendMessageLong Lib _
"user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Public Const EM_GETLINECOUNT = &HBA
Form Code
Sub Text1_Change()
Dim lineCount as Long
On Local Error Resume Next '得到/显示文本行数
lineCount = SendMessageLong(Text1.hwnd, EM_GETLINECOUNT, 0&, 0&)Label1 = Format$(lineCount, "##,###")
End Sub
注释:为了使本程序成功,请在设计阶段把文本框的Multiline属性设为True。作者: ynjxw 时间: 2009-8-25 18:19
我用字数控制:
Private Sub 主体_Format(Cancel As Integer, FormatCount As Integer)
If Len(Me.L3.Caption) <= 4 Then
Me.L3.TopMargin = 105
Else
Me.L3.TopMargin = 0
End If作者: ggguan@yeah.net 时间: 2015-5-8 15:53
分分分作者: ggguan@yeah.net 时间: 2015-5-9 10:45
分分分分作者: dd2213366788 时间: 2020-4-6 23:42
学习学习