How To Dynamically Adjust RadRichTextEditor Height To Fit Its Content
Environment
Product Version | Product | Author |
---|---|---|
2019.2.508 | RadRichTextEditor for WinForms | Hristo Merdjanov |
Description
An example demonstrating how the RadRichTextEditor height can be adjusted to match the height of its document. The end result is that the height of the control is dynamically updated whenever the document changes so that it is always entirely visible.
The solution in this article is not suitable for the Paged document layout mode.
Solution
The desired behavior can be achieved with the help of the vertical scroll bar. The scroll bar is always synced with the loaded document and it is possible to adjust the height of the control according to its maximum value. In order to prevent the scroll bars from appearing it will be necessary to handle the RadPropertyChanging event and cancel it when their visibility is about to be changed.
Figure 1: Adjusting RadRichTextEditor Height