Back to Devexpress

LayoutElementBase.Bounds Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-layout-dot-layoutelementbase.md

latest4.9 KB
Original Source

LayoutElementBase.Bounds Property

Gets coordinates of a rectangle which encompasses the layout element.

Namespace : DevExpress.XtraRichEdit.API.Layout

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
public Rectangle Bounds { get; }
vb
Public ReadOnly Property Bounds As Rectangle

Property Value

TypeDescription
Rectangle

A Rectangle structure specifying the coordinates of the layout element measured in twips (pixels for Linux OS).

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the Bounds 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-layout-api/CS/MyLayoutPainter.cs#L18

csharp
{
    Canvas.DrawRectangle(new RichEditPen(Color.FromArgb(141, 179, 226)), plainTextBox.Bounds);
}

winforms-richedit-layout-api-practical-usage/CS/WindowsFormsApplication1/DocumentLayoutHelper/DocumentElementLayoutHelper.cs#L26

csharp
returnedInformation += String.Format("Paragrpah index: {0}\r\n", currentParagraphIndex + 1);
returnedInformation += String.Format("Text block bounds: {0}\r\n", currentTextBlock.Bounds);

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

csharp
public override void DrawLineNumberBox(LineNumberBox lineNumberBox) {
    Canvas.DrawString(lineNumberBox.Text, lineNumberFont, new RichEditBrush(NumberingFontColor), lineNumberBox.Bounds, this.richEditControl.LayoutUnit);
}

winforms-richedit-layout-api/VB/MyLayoutPainter.vb#L15

vb
If Form1.customDrawText = True Then
    Canvas.DrawRectangle(New RichEditPen(Color.FromArgb(141, 179, 226)), plainTextBox.Bounds)
Else

winforms-richedit-layout-api-practical-usage/VB/WindowsFormsApplication1/DocumentLayoutHelper/DocumentElementLayoutHelper.vb#L29

vb
returnedInformation &= String.Format("Paragrpah index: {0}" & Constants.vbCrLf, currentParagraphIndex + 1)
returnedInformation &= String.Format("Text block bounds: {0}" & Constants.vbCrLf, currentTextBlock.Bounds)

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

vb
Public Overrides Sub DrawLineNumberBox(ByVal lineNumberBox As LineNumberBox)
    Canvas.DrawString(lineNumberBox.Text, lineNumberFont, New RichEditBrush(NumberingFontColor), lineNumberBox.Bounds, richEditControl.LayoutUnit)
End Sub

Implements

Bounds

See Also

Measure Units in Rich Text Documents

LayoutElementBase Class

LayoutElementBase Members

DevExpress.XtraRichEdit.API.Layout Namespace