Sorry but I don't know whether this is the right place to ask this.

I want to create a scroll bar that can scroll the content in the main window. The difficulty is that I don't know how to calculate the accurate length of the whole content (blending of English and Chinese, so surely they have different width), and how many lines the whole content will be broken down into to fit the CURRENT window(window is to be resized from time to time).

Any clue on this will be greatly appreciated.
Thank you in advance.