Back to Devexpress

DrawEventArgs.Brick Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-draweventargs.md

latest3.0 KB
Original Source

DrawEventArgs.Brick Property

Gets a visual brick that represents this control’s contents on a report page.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public VisualBrick Brick { get; }
vb
Public ReadOnly Property Brick As VisualBrick

Property Value

TypeDescription
VisualBrick

A VisualBrick object which represents the control’s contents.

|

Remarks

Use the Brick property to access the VisualBrick containing information about this control on a report page. Note that if this control is rendered several times in the document (e.g. if the control is bound to data), then this property returns a brick which corresponds to a particular rendering for this control.

Example

The following example demonstrates how to use the XRControl.Draw event. The handler method below draws a red ellipse in the rectangle occupied by the XRControl object.

csharp
using System.Drawing;
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
// ...

private void xrControl1_Draw(object sender, DrawEventArgs e) {
    // Get a rectangle occupied by a control.
    Rectangle rect = Rectangle.Truncate(e.Bounds);

    if(e.UniGraphics is GdiGraphics) {
        // Obtain a Graphics object.
        GdiGraphics graph = (GdiGraphics)e.UniGraphics;

        // Fill the interior of the ellipse defined
        // by the rectangle with a Red color.
        graph.Graphics.FillEllipse(Brushes.Red, rect);
    }
}
vb
Imports System.Drawing
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraReports.UI
' ...

Private Sub XrControl1_Draw(ByVal sender As Object, ByVal e As DrawEventArgs) _
Handles XrControl1.Draw
    ' Get a rectangle occupied by a control.
    Dim rect As Rectangle = Rectangle.Truncate(e.Bounds)

    If TypeOf e.UniGraphics Is GdiGraphics Then
        ' Obtain a Graphics object.
        Dim graph = CType(e.UniGraphics, GdiGraphics)

        ' Fill the interior of the ellipse defined
        ' by the rectangle with a Red color.
        graph.Graphics.FillEllipse(Brushes.Red, rect)
    End If
End Sub

See Also

DrawEventArgs Class

DrawEventArgs Members

DevExpress.XtraReports.UI Namespace