Back to Devexpress

LinkBase.CreateDetailArea Event

corelibraries-devexpress-dot-xtraprinting-dot-linkbase-43904469.md

latest7.7 KB
Original Source

LinkBase.CreateDetailArea Event

Occurs when a detail section of the document is being generated.

Namespace : DevExpress.XtraPrinting

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

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public virtual event CreateAreaEventHandler CreateDetailArea
vb
Public Overridable Event CreateDetailArea As CreateAreaEventHandler

Event Data

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

PropertyDescription
GraphGets a BrickGraphics object used to draw in the current report.

Remarks

Handle the CreateDetailArea event to customize the detail section of a document.

The document creation events occur in the following order:

Note

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.CreateDetailArea event handler.

csharp
void link1_CreateDetailArea(object sender, CreateAreaEventArgs e) {
    e.Graph.StringFormat = e.Graph.StringFormat.ChangeAlignment(StringAlignment.Near);
    e.Graph.StringFormat = e.Graph.StringFormat.ChangeLineAlignment(StringAlignment.Center);
    e.Graph.Font = new DXFont("Tahoma", 16, DXFontStyle.Bold | DXFontStyle.Italic);
    e.Graph.BackColor = Color.DarkSeaGreen;
    e.Graph.BorderColor = Color.Black;
    Rectangle r;

    for (int i = 0; i < 2; i++) {
        r = new Rectangle(0, i * 50, 150, 50);
        e.Graph.DrawString("Hello World!", Color.Gold, r, BorderSide.All);
    }
}
vb
Private Sub link1_CreateDetailArea(ByVal sender As Object, ByVal e As CreateAreaEventArgs)
Handles link1.CreateDetailArea
    e.Graph.StringFormat = e.Graph.StringFormat.ChangeAlignment(StringAlignment.Near)
    e.Graph.StringFormat = e.Graph.StringFormat.ChangeLineAlignment(StringAlignment.Center)
    e.Graph.Font = New DXFont("Tahoma", 16, DXFontStyle.Bold Or DXFontStyle.Italic)
    e.Graph.BackColor = Color.DarkSeaGreen
    e.Graph.BorderColor = Color.Black
    Dim r As Rectangle

    For i As Integer = 0 To 1
        r = New Rectangle(0, i * 50, 150, 50)
        e.Graph.DrawString("Hello World!", Color.Gold, r, BorderSide.All)
    Next i
End Sub

The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateDetailArea 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.

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

csharp
// Subscribe to the events to customize the detail and marginal page header sections of a document.
link.CreateDetailArea += Link_CreateDetailArea;
link.CreateMarginalHeaderArea += Link_CreateMarginalHeaderArea;

reporting-winforms-merge-reports-runtime/CS/reportMerging/Form1.cs#L41

csharp
link.Margins = new DXMargins(reports.First<XtraReport>().Margins.Left, reports.First<XtraReport>().Margins.Right, reports.First<XtraReport>().Margins.Top, reports.Last<XtraReport>().Margins.Bottom);
    link.CreateDetailArea += link_CreateDetailArea;
}

web-forms-pivot-grid-export-additional-captions-header-or-footer/CS/Default.aspx.cs#L22

csharp
Link link2 = new Link();
link2.CreateDetailArea += new CreateAreaEventHandler(link2_CreateDetailArea);
link2.PrintingSystem = ps;

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

vb
' Subscribe to the events to customize the detail and marginal page header sections of a document.
AddHandler link.CreateDetailArea, AddressOf Link_CreateDetailArea
AddHandler link.CreateMarginalHeaderArea, AddressOf Link_CreateMarginalHeaderArea

reporting-winforms-merge-reports-runtime/VB/reportMerging/Form1.vb#L50

vb
Me.link.Margins = New DevExpress.Drawing.DXMargins(System.Linq.Enumerable.First(Of DevExpress.XtraReports.UI.XtraReport)(reports).Margins.Left, System.Linq.Enumerable.First(Of DevExpress.XtraReports.UI.XtraReport)(reports).Margins.Right, System.Linq.Enumerable.First(Of DevExpress.XtraReports.UI.XtraReport)(reports).Margins.Top, System.Linq.Enumerable.Last(Of DevExpress.XtraReports.UI.XtraReport)(reports).Margins.Bottom)
    AddHandler Me.link.CreateDetailArea, AddressOf Me.link_CreateDetailArea
End Sub

web-forms-pivot-grid-export-additional-captions-header-or-footer/VB/Default.aspx.vb#L21

vb
Dim link2 As Link = New Link()
AddHandler link2.CreateDetailArea, New CreateAreaEventHandler(AddressOf link2_CreateDetailArea)
link2.PrintingSystem = ps

See Also

LinkBase Class

LinkBase Members

DevExpress.XtraPrinting Namespace