Link the Shape Fill Color to a Data source Field

Hi, I would like to set the back color of a Shape object (Rounded rectangle) to a data source field (coming from my database). How?

Comments

  • edited November 2017
    use script, event = beforeprint, look at documentation, how to get value from data source.

    watch out, solidfill must be created for each datarow.
    // <ShapeObject Name="Shape1" Left="56.7" Top="434.7" Width="94.5" Height="94.5" Border.Width="2" Fill.Color="LightCoral" />
    FastReport.ShapeObject Shape1 = new FastReport.ShapeObject();
    Shape1.Name = "Shape1";
    Shape1.Left = FastReport.Utils.Units.Centimeters * 1.5f;
    Shape1.Top = FastReport.Utils.Units.Centimeters * 11.5f;
    Shape1.Width = FastReport.Utils.Units.Centimeters * 2.5f;
    Shape1.Height = FastReport.Utils.Units.Centimeters * 2.5f;
    Shape1.Border.Width = 2f;
    
    FastReport.SolidFill fill4 = new FastReport.SolidFill();
    Shape1.Fill = fill4;
    fill4.Color = Color.LightCoral;
    Shape1.Parent = Data1;
    

Leave a Comment