Back to Devexpress

CreateAreaEventArgs.Graph Property

corelibraries-devexpress-dot-xtraprinting-dot-createareaeventargs.md

latest4.8 KB
Original Source

CreateAreaEventArgs.Graph Property

Gets a BrickGraphics object used to draw in the current report.

Namespace : DevExpress.XtraPrinting

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

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public BrickGraphics Graph { get; }
vb
Public ReadOnly Property Graph As BrickGraphics

Property Value

TypeDescription
BrickGraphics

A BrickGraphics object.

|

Remarks

This property returns a BrickGraphics instance used to draw a report. Its members define the default settings such as font, fore and background colors, border sides, and alignment for all bricks created using the current BrickGraphics instance.

Example

The following example demonstrates how to write a LinkBase.CreateMarginalHeaderArea event handler. The handler will not work unless you write a LinkBase.CreateDetailArea event handler.

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

private void link1_CreateMarginalHeaderArea(object sender, CreateAreaEventArgs e) {
    string format = "Page {0} of {1}";
    e.Graph.Font = e.Graph.DefaultFont;
    e.Graph.BackColor = Color.Transparent;

    RectangleF r = new RectangleF(0, 0, 0, e.Graph.Font.Height);

    PageInfoBrick brick = e.Graph.DrawPageInfo(PageInfo.NumberOfTotal, format, 
        Color.Black, r, BorderSide.None);
    brick.Alignment = BrickAlignment.Far;
    brick.AutoWidth = true;

    brick = e.Graph.DrawPageInfo(PageInfo.DateTime, "", Color.Black, r, BorderSide.None);
    brick.Alignment = BrickAlignment.Near;
    brick.AutoWidth = true;
}
vb
Imports System.Drawing
Imports DevExpress.XtraPrinting
' ...

Private Sub Link1_CreateMarginalHeaderArea(ByVal sender As Object, ByVal e As _
CreateAreaEventArgs) Handles Link1.CreateMarginalHeaderArea

    Dim Format As String = "Page {0} of {1}"
    e.Graph.Font = e.Graph.DefaultFont
    e.Graph.BackColor = Color.Transparent

    Dim r As New RectangleF(0, 0, 0, e.Graph.Font.Height)

    Dim Brick As PageInfoBrick = e.Graph.DrawPageInfo(PageInfo.NumberOfTotal, Format, _
        Color.Black, r, BorderSide.None)
    Brick.Alignment = BrickAlignment.Far
    Brick.AutoWidth = True

    Brick = e.Graph.DrawPageInfo(PageInfo.DateTime, "", Color.Black, r, BorderSide.None)
    Brick.Alignment = BrickAlignment.Near
    Brick.AutoWidth = True
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Graph property.

Note

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.

reporting-printing-library-use-different-brick-types/CS/DifferentBrickTypes/Form1.cs#L119

csharp
// Specify required settings for the brick graphics.
BrickGraphics brickGraphics = e.Graph;
brickGraphics.BackColor = Color.White;

reporting-printing-library-use-different-brick-types/VB/DifferentBrickTypes/Form1.vb#L103

vb
' Specify required settings for the brick graphics.
Dim brickGraphics As BrickGraphics = e.Graph
brickGraphics.BackColor = Color.White

See Also

CreateAreaEventArgs Class

CreateAreaEventArgs Members

DevExpress.XtraPrinting Namespace