ActiveReports 14
GrapeCity.ActiveReports Assembly / GrapeCity.ActiveReports.SectionReportModel Namespace / Section Class / Format Event
Example

In This Topic
    Format Event
    In This Topic

    Occurs after the section's data is loaded and bound to the section's controls, but before the section is rendered to the canvas.

    Syntax
    'Declaration
     
    Public Event Format As EventHandler
    public event EventHandler Format
    Remarks

    The format event is the only event where the section's height may be changed.  This event may be used to set or change the properties of any controls, or load subreport controls with subreports.

    If the CanGrow or CanShrink property of any child control or the section itself is set to True, all of the growing and shrinking of child controls and the section itself takes place in this event.  Because of this, information about a control or section's height would not be accurate since ActiveReports might modify the value immediately after the event to account for any layout or data changes.

    Example
    private void detail_Format(object sender, System.EventArgs eArgs)
    {
        this.detail.AddBookmark("Products");
        this.detail.BackColor = System.Drawing.Color.Transparent;
        this.detail.CanGrow = true;
        this.detail.CanShrink = false;
        this.detail.Controls.Clear();
        this.detail.Height = 2.0f;
        this.detail.Name = "Products";
        this.detail.Visible = true;
        this.detail.SizeToFit();
    }
    Private Sub Detail1_Format(ByVal sender As Object, ByVal e As System.EventArgs) Handles Detail1.Format
        Me.Detail1.AddBookmark("Products")
        Me.Detail1.BackColor = System.Drawing.Color.Transparent
        Me.Detail1.CanGrow = True
        Me.Detail1.CanShrink = False
        Me.Detail1.Controls.Clear()
        Me.Detail1.Height = 2.0F
        Me.Detail1.Name = "Products"
        Me.Detail1.Visible = True
        Me.Detail1.SizeToFit()
    End Sub
    See Also