Back to Devexpress

RichEditView.AllowDisplayLineNumbers Property

officefileapi-devexpress-dot-xtrarichedit-dot-richeditview-8b794ab7.md

latest4.9 KB
Original Source

RichEditView.AllowDisplayLineNumbers Property

Gets or sets whether line numbers can be displayed in the view.

Namespace : DevExpress.XtraRichEdit

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
[DefaultValue(false)]
public virtual bool AllowDisplayLineNumbers { get; set; }
vb
<DefaultValue(False)>
Public Overridable Property AllowDisplayLineNumbers As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true to show line numbers if they are enabled; otherwise, false.

|

Remarks

To enable line numbering, set the SectionLineNumbering.CountBy value for the document section to a positive integer other than zero.

In SimpleView and DraftView views line numbers are outside the default visible area, so you have to provide a space to display them by setting the left padding to a higher value (use the SimpleView.Padding or the DraftView.Padding property, respectively).

Note

In Print Layout View use the PrintLayoutView.AllowDisplayLineNumbers property.

The following code snippets (auto-collected from DevExpress Examples) contain references to the AllowDisplayLineNumbers property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-richedit-enable-line-numbering-and-count-document-rows/CS/LineNumberingExample/Form1.cs#L35

csharp
this.richEditControl1.Views.DraftView.Padding = new PortablePadding(60, 4, 4, 0);
richEditControl1.Views.SimpleView.AllowDisplayLineNumbers = true;
richEditControl1.Views.DraftView.AllowDisplayLineNumbers = true;

winforms-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L616

csharp
richEditControl.Views.SimpleView.Padding = new DevExpress.Portable.PortablePadding(60, 4, 4, 0);
richEditControl.Views.SimpleView.AllowDisplayLineNumbers = true;
richEditControl.ActiveViewType = RichEditViewType.Simple;

winforms-richedit-enable-line-numbering-and-count-document-rows/VB/LineNumberingExample/Form1.vb#L31

vb
richEditControl1.Views.DraftView.Padding = New PortablePadding(60, 4, 4, 0)
richEditControl1.Views.SimpleView.AllowDisplayLineNumbers = True
richEditControl1.Views.DraftView.AllowDisplayLineNumbers = True

winforms-richeditcontrol-common-api/VB/RichEditAPISample/CodeExamples/RichEditControlActions.vb#L632

vb
richEditControl.Views.SimpleView.Padding = New DevExpress.Portable.PortablePadding(60, 4, 4, 0)
richEditControl.Views.SimpleView.AllowDisplayLineNumbers = True
richEditControl.ActiveViewType = RichEditViewType.Simple

See Also

How To: Add Line Numbering in the Rich Text Editor

AllowDisplayLineNumbers

RichEditView Class

RichEditView Members

DevExpress.XtraRichEdit Namespace