Skip to main content

BrickGraphics.DrawString(String, Color, RectangleF, BorderSide) Method

Adds a specific TextBrick to a report.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v22.2.Core.dll

NuGet Packages: DevExpress.Printing.Core, DevExpress.Win.Dashboard.Design


public TextBrick DrawString(
    string text,
    Color foreColor,
    RectangleF rect,
    BorderSide sides


Name Type Description
text String

The text displayed in a specific TextBrick.

foreColor Color

The color used to draw text.

rect RectangleF

The RectangleF structure that specifies the location and size of the current brick in measurement units, specified via the BrickGraphics.PageUnit property value.

sides BorderSide

Border settings for a specific TextBrick.


Type Description

The TextBrick added to a report.


This method adds a specific TextBrick to a report. TextBrick position and size are specified via the rect parameter. The area of the brick rectangle not used by the brick’s text is filled with the color defined via BrickGraphics.BackColor. The text color is specified via the foreColor parameter. Text is specified via the TextBrick.Font property value. If the foreColor parameter is set to Color.Empty, text color is defined via the BrickGraphics.ForeColor property value. Graphical settings which are not defined via these method parameters are obtained from the corresponding BrickGraphics properties.


This example demonstrates how to create a TextBrick using the BrickGraphics.DrawString method.


using DevExpress.XtraPrinting;
// ...

    VisualBrick visBrick;
    BrickGraphics brickGraph = printingSystem1.Graph;
    string s = "Developer Express Inc.";

    // Measure the string.
    SizeF sz = brickGraph.MeasureString(s);

    // Start the report generation.

    // Create a rectangle of the calculated size.
    RectangleF rect = new RectangleF(new PointF(0, 0), sz);
    // Specify a page area.
    brickGraph.Modifier = BrickModifier.Detail;
    // Create a text brick.
    visBrick = brickGraph.DrawString(s, Color.Black, rect, BorderSide.All);

    // Finish the report generation.

    // Preview the report.

The following code snippets (auto-collected from DevExpress Examples) contain references to the DrawString(String, Color, RectangleF, BorderSide) method.


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.

See Also