Results 1 to 2 of 2

Thread: Flat ScrollBar

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Thessaloniki ,Greece
    Posts
    100

    Question Flat ScrollBar

    Hello...

    I have try to use the Flat Scrollbar type to change the value of Rich Textbox control scrollbar.

    So I see how the Api code works and i make this program

    Const SB_VERT = 1

    'Const SIF_ALL = (SIF_RANGE Or SIF_PAGE Or SIF_POS)

    Private Declare Function InitializeFlatSB Lib "comctl32" (ByVal hWnd As Long) As Long
    Private Declare Function UninitializeFlatSB Lib "comctl32" (ByVal hWnd As Long) As Long
    Private Declare Function FlatSB_SetScrollPos Lib "comctl32" (ByVal hWnd As Long, ByVal code As Long, ByVal nPos As Long, ByVal fRedraw As Boolean) As Long
    Private Declare Function FlatSB_GetScrollPos Lib "comctl32" (ByVal hWnd As Long, ByVal code As Long) As Long

    Private Sub Form_Load()
    Dim Cnt As Byte
    ' I fill RichTextBox with something
    For Cnt = 1 To 30: RichTextBox1.TextRTF = RichTextBox1.Text + "Text" + Str(Cnt) + Chr(13) + Chr(13): Next Cnt

    ' Initialize the Flat style ScrollBars
    InitializeFlatSB RichTextBox1.hWnd

    GetSetScrollPosition
    End Sub

    Private Sub Form_Unload(Cancel As Integer)
    'Remove the Flat style ScrollBars
    UninitializeFlatSB RichTextBox1.hWnd
    End Sub

    Private Sub GetSetScrollPosition()
    Dim Pos As Long

    ' I get the current position
    Pos = FlatSB_GetScrollPos(RichTextBox1.hWnd, SB_VERT)

    ' I set new position (pos+100)
    FlatSB_SetScrollPos RichTextBox1.hWnd, SB_VERT, Pos + 100, True

    End Sub


    So my problem is this....

    When i set the new value the scrollbar goes down but the Rtf text doesn’t go.

    I try to refresh the Rtf control but still nothing.

    So anybody knows what happen and the scrollbar don't work correctly

  2. #2
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613
    I don't have it with me right now. Email me, I'll send you a sample project.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width