Skip to main content
Box

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PageCanvas.DrawLine(RichEditPenBase, Int32, Int32, Int32, Int32) Method

Draws a custom line.

Namespace: DevExpress.XtraRichEdit.API.Layout

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

NuGet Package: DevExpress.RichEdit.Core

#Declaration

public void DrawLine(
    RichEditPenBase pen,
    int x1,
    int y1,
    int x2,
    int y2
)

#Parameters

Name Type Description
pen RichEditPenBase

The RichEditPenBase descendant that sets the line’s color and thickness.

x1 Int32

Sets the x-coordinate of the line’s start point.

y1 Int32

Sets the y-coordinate of the line’s start point.

x2 Int32

Sets the x-coordinate of the line’s end point

y2 Int32

Sets the y-coordinate of the line’s end point

#Remarks

To set the line style, use the RichEditPenBase.DashStyle method.

#Example

This code snippet illustrates the implementation of the PageCanvas.DrawRectangle and PageCanvas.DrawLine methods. They draw a color rectangle and two crossed lines in place of the inline pictures.

View Example

Public Overrides Sub DrawInlinePictureBox(ByVal inlinePictureBox As InlinePictureBox)
    If Form1.customDrawPicture = True Then
        Dim Ebounds As Rectangle = inlinePictureBox.Bounds
        Dim pen As New RichEditPen(Color.Maroon, 2)
        pen.DashStyle = RichEditDashStyle.Dot
        Canvas.DrawLine(pen, New Point(Ebounds.X, Ebounds.Y + Ebounds.Height), New Point(Ebounds.X + Ebounds.Width, Ebounds.Y))
        Canvas.DrawLine(pen, New Point(Ebounds.X, Ebounds.Y), New Point(Ebounds.X + Ebounds.Width, Ebounds.Y + Ebounds.Height))
        Dim inlineRect As New Rectangle(Ebounds.X, Ebounds.Y, Ebounds.Width, Ebounds.Height)
        Canvas.DrawRectangle(New RichEditPen(Color.Aquamarine, 4), inlineRect)
    Else
        MyBase.DrawInlinePictureBox(inlinePictureBox)
    End If
End Sub
See Also