Back to Devexpress

TextBrick Class

corelibraries-devexpress-dot-xtraprinting-065fa8a3.md

latest5.0 KB
Original Source

TextBrick Class

A visual brick that contains text.

Namespace : DevExpress.XtraPrinting

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

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
[BrickExporter(typeof(TextBrickExporter))]
public class TextBrick :
    TextBrickBase,
    ITextBrick,
    IVisualBrick,
    IBaseBrick,
    IBrick,
    ITableCell
vb
<BrickExporter(GetType(TextBrickExporter))>
Public Class TextBrick
    Inherits TextBrickBase
    Implements ITextBrick,
               IVisualBrick,
               IBaseBrick,
               IBrick,
               ITableCell

The following members return TextBrick objects:

Remarks

TextBrick is used to type plain text in a document and provides options that define the text color, alignment, font and format settings.

To print rotated text in your document, use the LabelBrick class.

To insert rich text into your document, use the RichTextBrick class.

Example

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

csharp
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.
    printingSystem1.Begin();

    // 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.
    printingSystem1.End();

    // Preview the report.
    printingSystem1.PreviewFormEx.Show();
vb
Imports DevExpress.XtraPrinting
' ...

    Dim visBrick As VisualBrick
    Dim brickGraph As BrickGraphics = printingSystem1.Graph
    Dim s As String = "Developer Express Inc."

    ' Measure the string.
    Dim sz As SizeF = brickGraph.MeasureString(s)

    ' Start the report generation.
    printingSystem1.Begin()

    ' Create a rectangle of the calculated size.
    Dim rect As RectangleF = 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.
    printingSystem1.End()

    ' Preview the report.
    printingSystem1.PreviewFormEx.Show()

Implements

IXtraSupportDeserializeCollectionItem

IBrick

ITableCell

Inheritance

Show 11 items

Object DevExpress.Printing.Utils.DocumentStoring.StorableObjectBase BrickBase Brick VisualBrick TextBrickBase TextBrick LabelBrick

PageInfoTextBrickBase

PageInfoBrick

PageInfoTextBrick

See Also

TextBrick Members

Bricks

Classes Hierarchy: Bricks

DevExpress.XtraPrinting Namespace