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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.