Fired before a field is rendered by the designer.

Namespace:  C1.Win.C1ReportDesigner
Assembly:  C1.Win.C1ReportDesigner.2 (in C1.Win.C1ReportDesigner.2.dll)

Syntax

C#
public event RenderFieldEventHandler RenderField
Visual Basic
Public Event RenderField As RenderFieldEventHandler

Remarks

The event handler can change the text displayed in the field and the way the field is displayed.

To change the text displayed in the field, change the value of the Text property in the RenderFieldEventArgs event arguments (the designer shows the field's Text()()()() property by default).

To customize the way the field is displayed, use the Render()()()() method in the RenderFieldEventArgs event arguments. You can either change some field properties, call the Render method, then restore the properties, or use the Graphics object to draw on the design surface.

Examples

The code below shows calculated fields using a red background, and draws a blue diagonal over barcode fields:
Copy CodeC#
private void c1ReportDesigner1_RenderField(object sender, RenderFieldEventArgs e)
{
  C1.Win.C1Report.Field f = e.Field;

  // save field's current backcolor
  Color color = f.BackColor;

  // render calculated fields in red
  if (f.Calculated)
    f.BackColor = Color.Red;

  // let the designer render the field
  e.Render();

  // draw a diagonal line over barcode fields
  if (f.BarCode != C1.Win.C1Report.BarCodeEnum.None)
  {
    Rectangle rc = e.Bounds;
    e.Graphics.DrawLine(Pens.Blue, rc.X, rc.Y, rc.Right, rc.Bottom);
  }

  // restore original background color.
  f.BackColor = color;
}

See Also