Skip to main content

LinkBase.CreateMarginalHeaderArea Event

Occurs when a marginal page header section of the document is being generated.

Namespace: DevExpress.XtraPrinting

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

NuGet Package: DevExpress.Printing.Core

Declaration

public event CreateAreaEventHandler CreateMarginalHeaderArea

Event Data

The CreateMarginalHeaderArea event's data class is CreateAreaEventArgs. The following properties provide information specific to this event:

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

Remarks

Handle the CreateMarginalHeaderArea event to customize the marginal page header section of a document.

The content specified via the CreateMarginalHeaderArea and LinkBase.CreateMarginalFooterArea methods is shifted by the values of the Top and Bottom margins (defined via the LinkBase.MinMargins property), respectively.

Document creation events occur in the following order (this order may be different in descendants of the LinkBase class):

For more information on handling events, see Events and Delegates in MSDN.

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.

Tutorial Areas

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;
}

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

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.

See Also