ActiveReports 10
Create Green Bar Reports
ActiveReports 10 > ActiveReports User Guide > How To > Section Report How To > Create Common Section Reports > Create Green Bar Reports

In a section report, green bar printouts can be created by setting alternate shades or background color in the report's detail section in the Format event. The following steps demonstrate how to create a Green Bar report.

  1. On the design surface, double-click the detail section of the report to create an event handling method for the Detail Format event.
  2. Add the following code to the handler to alternate background colors.

    To write the code in Visual Basic.NET

    Visual Basic.NET code. Paste JUST ABOVE the Detail Format event.
    Copy Code
    Dim color As Boolean
    Visual Basic.NET code. Paste INSIDE the Detail Format event.
    Copy Code
    If color = True Then
        Me.Detail1.BackColor = System.Drawing.Color.DarkSeaGreen
        color = False
    Else
        Me.Detail1.BackColor = System.Drawing.Color.Transparent
        color = True
    End If
    

    To write the code in C#

    C# code. Paste JUST ABOVE the Detail Format event.
    Copy Code
    bool color;
    C# code. Paste INSIDE the Detail Format event.
    Copy Code
    if(color)
    {
        this.detail.BackColor = System.Drawing.Color.DarkSeaGreen;
        color = false;
    }
    else
    {
        this.detail.BackColor = System.Drawing.Color.Transparent;
        color = true;
    }
    
  3. Add controls like TextBox to the report design surface and preview the report.

The following image shows a Green Bar report alternating between Transparent and Dark Sea Green backgrounds:

See Also