Skip to main content

IBasePrintable.CreateArea(String, IBrickGraphics) Method

When implemented by a class, creates report elements (bricks) for a specific area.

Namespace: DevExpress.XtraPrinting

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

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


void CreateArea(
    string areaName,
    IBrickGraphics graph


Name Type Description
areaName String

The name of the report area (section) for which elements should be created.

graph IBrickGraphics

An object implementing the IBrickGraphics interface, which is a graphical surface on which report elements will be drawn.


A description of report generation is provided below. It involves using the IPrintable interface, which is a IBasePrintable descendant:

  1. A user generates a report with the ILink.CreateDocument method.
  2. A link knows about the IBasePrintable control to which it refers, and calls the IBasePrintable.Initialize method.
  3. Next, the CreateArea method is called for each section of the report. Refer to the Document Sections topic, to learn about report section types.

When implemented, the CreateArea method must construct different bricks, based on the section type, and information provided by the control.

The following code implements the CreateArea method for the control. The initialized graph object is of the IBrickGraphics interface type, and will be used in other methods listed below.

void IBasePrintable.CreateArea(string areaName, IBrickGraphics graph) {
    this.graph = graph;
    if( areaName.Equals("PageFooter") )
    else if( areaName.Equals("DetailHeader") )
    else if( areaName.Equals("Detail") )

Different methods are called to create the contents for the PageFooter, DetailHeader, and Detail sections. In the following code, we used only the CreatePageFooter method. The DrawBrick method creates a brick object by its name and sets its properties. The ps object of the IPrintingSystem interface was specified by the IBasePrintable.Initialize method.

private IBrick DrawBrick(string typeName, object[,] properties, RectangleF rect) {
    IBrick brick = ps.CreateBrick(typeName);
    return graph.DrawBrick(brick, rect);

private void CreatePageFooter() {
    string format = "Page {0} of {1}";
    DXFont font = new DXFont("Arial", 9);
    graph.DefaultBrickStyle = new BrickStyle(BorderSide.None, 1,
        Color.Black, Color.Transparent, Color.Black, font,
        new BrickStringFormat(StringAlignment.Center, StringAlignment.Center));

    float height = font.Height + 2;

    RectangleF r = new RectangleF(0, 0, 0, height);

    DrawBrick("PageInfoBrick", new object[,] { {"PageInfo",PageInfo.DateTime},
    {"AutoWidth",true}, {"Alignment",BrickAlignment.Near} }, r);
    DrawBrick("PageInfoBrick", new object[,] { {"PageInfo",PageInfo.NumberOfTotal}, 
    {"Format",format}, {"Alignment",BrickAlignment.Far}, {"AutoWidth",true} }, r);

The image below demonstrates the PageFooter section of the resulting report.


See Also