根据timer的值来控制当前显示的行数!

解决方案 »

  1.   

    不如直接把所有内容都放到LAB里面,两边用个什么东西挡起来,然后用TIMER来控制其TOP属性。LAB还支持背景透明,想怎么弄都可以。
      

  2.   

    Dim LastLine As Long    '最后的行数
    Dim LineHeight          '每行的高度Private Sub Form_Load()
        Set Me.Font = Text1.Font
        LineHeight = Me.TextHeight("TT")
    End Sub
    '查询行数,并及时修改
    Private Sub Text1_Change()
        Dim Ret As Long
        Ret = SendMessage(Text1.hwnd, EM_GETLINECOUNT, 0, 0&)   '取行数
        If Ret <> LastLine Then
            If Text1.Height + Text1.Top + LineHeight > Me.ScaleHeight And _
                Ret > 1 Then
                
                If LastLine <= Ret - 1 Then
                    Exit Sub
                                            '如果是最大高度,保持不变
                End If
                LastLine = Ret - 1          '超过最大高度
            Else
                LastLine = Ret
            End If
            Text1.Height = LastLine * LineHeight       '修改高度
        End If
        Debug.Print Me.ScaleHeight
    End Sub
    Private Sub Text1_GotFocus()
        LastLine = SendMessage(Text1.hwnd, EM_GETLINECOUNT, 0, 0&)
    End Sub
      

  3.   

    上面还要加
    modoul1Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    (ByVal hwnd As Long, _
    ByVal wMsg As Long, _
    ByVal wParam As Long, _
    lParam As Any) As Long
    Public Const EM_GETLINECOUNT = &HBA