All pastes #40898 Raw Edit

Scroll RTF text wind

public text v1 · immutable
#40898 ·published 2006-02-09 20:15 UTC
rendered paste body
    Private Declare Function GetScrollRange Lib "User32" (ByVal hWnd As IntPtr, ByVal nBar As Integer, ByRef lpMinPos As Integer, ByRef lpMaxPos As Integer) As Boolean
    Private Overloads Declare Auto Function SendMessageSP Lib "user32" Alias "SendMessageA" (ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As POINT) As IntPtr
    Public Shared Sub ScrollToBottom(ByVal Handle As IntPtr, ByVal Height As Long)
        Dim Min, Max As Integer
        GetScrollRange(Handle, ScrollBarFlags.SBS_VERT, Min, Max)
        SendMessageSP(Handle, EMFlags.EM_SETSCROLLPOS, 0, New Point(0, Max - Height))
        
    End Sub