FlexReport for WinForms | ComponentOne
Fields and Custom Fields / Shape Field
In This Topic
    Shape Field
    In This Topic

    Shape fields are used to display geometric shapes in reports. Lines are often used as separators, rectangles are used to highlight groups of fields or to create tables and grids, and so on.

    You can also set rules for defining visibility of a shape in the expressions. For example, if you want Product names to be enclosed in a rectangular shape when the Reorder Level is less than the Units in Stock, you can write following expression in the OnPrint property of the report, to define when to turn on the visibility of shape:

    
            If UnitsInStock < ReorderLevel Then
            Shapefld.Visible = True
            Else
            Shapefld.Visible = False
            End If
    

    You can also use the FlexReportDesigner application to type the following script code directly into the VBScript Editor of the Detail section's OnPrint property. Complete the following steps:

    1. Select Detail from the Properties window drop-down list in the Designer. This reveals the section's available properties.
    2. Click the ellipsis next to the OnPrint property, to open VBScript Editor.
    3. In the VBScript Editor, simply type the following script:
      
      If UnitsInStock < ReorderLevel Then 
      Shapefld.Visible = True
      Else
      Shapefld.Visible = False   
      End If
      

    The following screen capture shows a section of the report with the special effects:

     Show or Hide a Shape Field in FlexReport