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

    The four properties controlling the size and location of a render object are:

    All those properties have the value type C1.C1Preview.Unit. The default value for X and Y is Auto (represented by the static field Unit.Auto), which means that the object is positioned according to the stacking rules provided by its parent (see Stacking above for more information). Width and height have different defaults depending on the type of the render object.

    The following table lists the default sizes (width and height) for all render objects, as well as the rules used to calculate auto sizes:

    Width Height Auto Size
    RenderArea
    RenderToc
    RenderReport
    RenderSection
    RenderC1Printable
    Parent width Auto Determined by the combined size of the children
    RenderEmpty Auto Auto 0
    RenderGraphics Auto Auto Determined by the size of the content
    RenderImage Auto Auto Determined by the size of the image
    RenderInputButton RenderInputCheckBox RenderInputRadioButton RenderInputComboBox RenderInputText Auto Auto Determined by the size of the content
    RenderRichText Parent width (auto width is not supported). Auto (determined by the text size). --
    RenderLine RenderPolygon RenderEllipse RenderArc RenderPie RenderRectangle RenderRoundRectangle Auto Auto Determined by the size of the shape
    RenderTable Parent width (auto width is calculated as the sum of columns' widths). Auto Determined by the total width of all columns for width, and by the total height of all rows for height
    RenderParagraph RenderText RenderTocItem Parent width Auto Determined by the size of the text
    RenderField Parent width Auto Determined by the size of the content
    RenderBarCode Auto Auto Determined by the size of the content

    You can override the default values for any of those properties with custom values (specifying anything but Auto as the value for X or Y coordinates excludes the object from the stacking flow; see Stacking for more information). The size and location properties can be set in any of the following ways (note that ro indicates a render object in the samples below):

    In all of the above samples where a size or location is set to a string, the syntax using the Unit(string) constructor can also be used, for example:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    ro.Width = New C1.C1Preview.Unit("150%prev")
    

    To write code in C#

    C#
    Copy Code
    ro.Width = new Unit("150%prev");
    

    Case is not important in strings, so "prev.width", "PrEv.WidTh", and "PREV.WIDTH" are equivalent.