IBasePrintable.CreateArea(String, IBrickGraphics) Method

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

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Data.v21.2.dll


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.

Sub CreateArea(ByVal areaName As String, ByVal graph As IBrickGraphics) _
Implements IBasePrintable.CreateArea
    Me.graph = graph
    If areaName.Equals("PageFooter") Then
    ElseIf areaName.Equals("DetailHeader") Then
    ElseIf areaName.Equals("Detail") Then
    End If
End Sub

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 Function DrawBrick(ByVal typeName As String, ByVal properties As Object(,), ByVal rect _
As RectangleF) As IBrick
    Dim brick As IBrick = ps.CreateBrick(typeName)
    Return graph.DrawBrick(brick, rect)
End Function

Private Sub CreatePageFooter()
    Dim format As String = "Page {0} of {1}"
    Dim font As Font = New Font("Arial", 9)

    graph.DefaultBrickStyle = New BrickStyle(BorderSide.None, 1, _
        Color.Black, Color.Transparent, Color.Black, font, _
        New BrickStringFormat(StringAlignment.Center, StringAlignment.Center))

    Dim height As Single = font.Height + 2

    Dim r As RectangleF = 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)

End Sub

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


The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateArea(String, IBrickGraphics) 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