Scrolling in TRichView
Documents in RichView can have almost unlimited height. But ranges of scrollbars are limited, and RichView cannot use pixels as scrolling units (small step of scrollbar). Scrolling units of RVScroller (ancestor of RichView) are referred here as "RVSU" (RichView Scrolling Units). By default, 1 RVSU = 10 pixels, but the component can increase it automatically during formatting if the range of vertical scrollbar exceeds 30,000. You can set a number of pixels in 1 RVSU with VSmallStep property (but the component can increase it during formatting).
For example, you may want to set RVSU to the height of one line of the normal text. After assigning a new value to VSmallStep, you should reformat document using Format method).
You can also use method ScrollTo for scrolling to the specified vertical position, measured in pixels.
ScrollTo(y) is equivalent to VScrollPos := y div VSmallStep, so ScrollTo cannot scroll exactly to the specified position.
You can show and hide vertical scrollbar with VScrollVisible property.
DocumentHeight property is a vertical height of a document in pixels (height of scrollable area). For example, you can use this value to set height of RichView. DocumentHeight includes values of TopMargin and BottomMargin.
You can get vertical coordinate in document for:
▪any item (GetItemCoords)
Horizontal scrollbar appears automatically when necessary.
You can hide it with HScrollVisible property.
By default, if the document does not contain wide images, controls or tables, text is wrapped to fit the client width of RichView minus margins.
If there are pictures or controls, width of scrolling area is equal to
max(client width of RichView,
"maximal width of pictures or controls" +
and text is wrapped to fit width of the scrolling area minus margins.
Text in paragraphs with no-wrap option can also affect to width of scrolling area, in the same was as wide pictures or controls.
Use MinTextWidth property to set the minimal width for text wrapping (text wraps when its length in pixels exceeds this value). Horizontal scrollable area cannot be less than MinTextWidth+margins (but can be greater because of wide pictures or wide client width of RichView). You can use MinTextWidth to speed up formatting when RichView is resized. Formatting is very quick if width of scrollable area is not changed. For example, if you set MinTextWidth to the size of screen, RichView will not perform full reformatting when user resizes it (well, it's not convenient to read text with horizontal scrollbar)
Use MaxTextWidth property to set maximal width for text wrapping. This value does not affect width of scrollable area.
A similar effect can be achieved using rvoClientTextWidth option from Options. If this option is set, width for text wrapping is always equal to client width of RichView minus margins. It is useful if your document can have wide pictures or controls, or no-wrap paragraphs.
You can set no-wrap option for paragraph style. If this option is set, this paragraph will not be wrapped automatically.