How to make self-defined vertical scroll bar(編號:2258)

Hi,
Could anyone teach me how to make self-defined vertical scroll bar in rich text box whose scroll value is corresponding to the line no. in the text box? i.e.the scrolling function of the self-defined vsb behaves in the similar way to that of notepad. I know how to use API to get no. of line in rich text box, but don't know how to use the no. of line to write self-defined vsb.
Thx.