Reports for WinForms | ComponentOne
Working with C1PrintDocument / Render Objects / Render Objects Containment, Positioning, and Stacking Rules
In This Topic
    Render Objects Containment, Positioning, and Stacking Rules
    In This Topic

    All visible content of a C1PrintDocument is represented by a tree of render objects (instances of types derived from RenderObject, as described above), with the root of the tree being the Body of the document. So in order to add a render object to the document, it must be either added to the Children collection of the document's Body, or to the Children collection of another object already in the hierarchy. For example, the render text in the following code is added to the document's Body.Children collection:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Dim doc As New C1PrintDocument()
    Dim rt As New RenderText()
    rt.Text = "This is a text."
    doc.Body.Children.Add(rt)
    

    To write code in C#

    C#
    Copy Code
    C1PrintDocument doc = new C1PrintDocument();
    RenderText rt = new RenderText();
    rt.Text = "This is a text.";
    doc.Body.Children.Add(rt);
    

    A document's Body.Children collection contains all top-level render objects of the document. Each render object in its turn also has a Children collection, which contains render objects within it, and so on. (This is very similar to the way Windows Forms' controls can be nested inside each other - any control has the collection of contained controls, and so on.)

    In addition to the document's body, there are two other places for render objects in a document - the page header and footer, accessible via the PageHeader and PageFooter properties.

    See Also