ActiveReports 18 .NET Edition
Report Authors: Designer Components / Design Reports / Design Section Reports / Tutorials: Section Report Scenarios / Create Green Bar Report
In This Topic
    Create Green Bar Report
    In This Topic

    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 in a sample report PurchaseOrder.rpx that can be can be downloaded from GitHub: ..\Samples18\DesignerPro\ReportsGallery\Reports\Section Report\.

    Design Report Layout

    Design green bar report layout

    1. On the design surface of the report, double-click the detail section of the report to create an event handling method for the Detail Format event.
    2. Add the following script to create alternate background colors.
      Visual Basic.NET code. Paste JUST ABOVE the Detail Format event.
      Copy Code
      Dim i As Integer = 0
      
      Visual Basic.NET code. Paste INSIDE the Detail Format event.
      Copy Code
      If i Mod 2 = 0 Then
          Me.detail.BackColor = System.Drawing.Color.PaleGreen
      Else
          Me.detail.BackColor = System.Drawing.Color.Transparent
      End If 
      i += 1
      
      C# code. Paste JUST ABOVE the Detail Format event.
      Copy Code
      int i = 0;
      
      C# code. Paste INSIDE the Detail Format event.
      Copy Code
      if (i % 2 == 0) {
        this.detail.BackColor = System.Drawing.Color.PaleGreen;
      } else {
        this.detail.BackColor = System.Drawing.Color.Transparent;
      }
      i++;
      
    3. Preview the report and see a Green Bar report alternating between Transparent and Pale Green backgrounds.