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