Dim l_cnt As Double '记录录入的行数
Dim s_height As Integer '文本框高度
Dim l_updown As Integer '判断增加还是删除
Private Sub Form_Load()
Text1.Text = ""
Let l_cnt = 1
Let s_height = Text1.Height
End Sub
Private Sub Text1_Change()
If Len(Text1) > 0 Then
If l_updown = 0 Then
If Len(Text1) Mod 4 = 0 Then
Let l_cnt = l_cnt + 0.5
Else
If Len(Text1) Mod 4 < 4 Then
Let l_cnt = l_cnt
End If
Text1.Height = s_height * l_cnt
End If
Else
If (Len(Text1) - 1) Mod 4 = 0 Then
Let l_cnt = l_cnt - 0.5
Else
If Len(Text1) Mod 4 < 4 Then
Let l_cnt = IIf(l_cnt > 0, l_cnt, 1)
End If
Text1.Height = s_height * l_cnt
End If
End If
End If
If l_cnt < 1 Then l_cnt = 1
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 8 Then
Let l_updown = 1
Else
Let l_updown = 0
End If
End Sub