This example illustrates two methods to specify default document formatting. The project contains two RichEditControl instances that use different default formatting options.
The main RichEditControl uses parameters specified by the Document.DefaultCharacterProperties and Document.DefaultParagraphProperties options in the RichEditControl.DocumentLoaded event handler.
The New Document button executes the CreateNewDocument method that, in turn, raises the EmptyDocumentCreated event. In the event handler, the document is generated with another set of default settings specified by the Document.DefaultCharacterProperties and Document.DefaultParagraphProperties properties.
The Show New Editor button invokes the other RichEditControl instance that uses default settings specified by the RichEditControlCompatibility.DefaultFontName and RichEditControlCompatibility.DefaultFontSize properties on application startup.
Warning
Starting with v19.2, the
RichEditControl
uses document themes to retrieve default document font information. As such, theRichEditControlCompatibility.DefaultFontName
property will no longer affect the default document font.Set the RichEditControlCompatibility.UseThemeFonts property to
false
when starting the application to restore the previous behavior in all instances of the RichEdit components. Set the RichEditBehaviorOptions.UseThemeFonts property tofalse
before loading a new document to disable themes for a specific component.
The Load Text Document button loads a document to both RichEditControl instances. As a result, the document has different format options in each instance.
- Form1.cs (VB: Form1.vb)
- Program.cs (VB: Program.vb)
(you will be redirected to DevExpress.com to submit your response)