ActiveReports 15 .NET Edition
ActiveReports 15 User Guide / How To / Section Report How To / Section Report Scenarios / Create Green Bar Reports
In This Topic
    Create Green Bar Reports
    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.

    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:

    A Green Bar report

    A Green Bar report

    See Also