ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Printing and Previewing Task-Based Help > Formatting Tables > Rendering Overlapping Objects in a Table

Rendering Overlapping Objects in a Table

You can easily render overlapping objects in a table cell. For example, add the following code to the Form_Load event before the Generate method to add a square overlapped by two crossing lines in the table:

      Visual Basic

' Create a rectangle, and two lines to form an 'X'.

Dim rect As New RenderRectangle(New Unit(3, UnitTypeEnum.Cm), New Unit(3, UnitTypeEnum.Cm))

Dim rl1 As New RenderLine(New Unit(0, UnitTypeEnum.Cm), New Unit(0, UnitTypeEnum.Cm), New Unit(3, UnitTypeEnum.Cm), New Unit(3, UnitTypeEnum.Cm), LineDef.[Default])

Dim rl2 As New RenderLine(New Unit(3, UnitTypeEnum.Cm), New Unit(0, UnitTypeEnum.Cm), New Unit(0, UnitTypeEnum.Cm), New Unit(3, UnitTypeEnum.Cm), LineDef.[Default])

rect.Style.BackColor = Color.PeachPuff

 

' Add the objects to the table.

table.Cells(1, 1).Area.Children.Add(rect)

table.Cells(1, 1).Area.Children.Add(rl1)

table.Cells(1, 1).Area.Children.Add(rl2)

      C#

// Create a rectangle, and two lines to form an 'X'.

RenderRectangle rect = new RenderRectangle(new Unit(3, UnitTypeEnum.Cm), new Unit(3, UnitTypeEnum.Cm));

RenderLine rl1 = new RenderLine(new Unit(0, UnitTypeEnum.Cm), new Unit(0, UnitTypeEnum.Cm), new Unit(3, UnitTypeEnum.Cm), new Unit(3, UnitTypeEnum.Cm), LineDef.Default);

RenderLine rl2 = new RenderLine(new Unit(3, UnitTypeEnum.Cm), new Unit(0, UnitTypeEnum.Cm), new Unit(0, UnitTypeEnum.Cm), new Unit(3, UnitTypeEnum.Cm), LineDef.Default);

rect.Style.BackColor = Color.PeachPuff;

 

// Add the objects to the table.

table.Cells[1, 1].Area.Children.Add(rect);

table.Cells[1, 1].Area.Children.Add(rl1);

table.Cells[1, 1].Area.Children.Add(rl2);

 What You've Accomplished

The table appears with a square with two overlapping lines:

 


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.