Files to look at:
WinForms - The RichEditControl's common API
This example demonstrates how to use RichEditControl's API to programmatically manage the RichEditControl's behavior (commands, services).
The application includes the RichEditControl (at the bottom) used to display and edit the code and another RichEditControl (at the top) which shows the result of code execution.
Some of the RichEditControl's methods are executed by clicking the "Custom Action" button located in the RichEditControl's Ribbon menu.