PrintDocument for WinForms | ComponentOne
C1.PrintDocument.4.5.2 Assembly / C1.C1Preview Namespace / RenderObject Class / ObjectResolvedScript Property

In This Topic
    ObjectResolvedScript Property (RenderObject)
    In This Topic
    Gets or sets the script that is executed when the current object has been completely resolved, all its fragments created and added to the Fragments collection of the current object.
    Syntax
    'Declaration
     
    Public Property ObjectResolvedScript As String
    public string ObjectResolvedScript {get; set;}
    Remarks
    This script may be used to adjust the look of an object after resolving, for instance the background of the object may be set depending on whether the object has been split between pages (i.e. the Fragments collection contains more than 1 element). The following code sets the background of a RenderArea to red if it has been split between pages, and to green if it has not been split: C1PrintDocument doc = new C1PrintDocument(); RenderArea ra = new RenderArea(); ra.ObjectResolvedScript = "if RenderObject.Fragments.Count > 1 then\r\n" + "RenderObject.Style.BackColor = Color.Red\r\n" + "else\r\n" + "RenderObject.Style.BackColor = Color.Green\r\n" + "end if\r\n"; ra.Style.Borders.All = LineDef.DefaultBold; // ... fill ra with sample content: for (int i = 0; i < 30; i++) ra.Children.Add(new RenderText("Line " + i.ToString())); doc.Body.Children.Add(ra); Note that while you can adjust any style properties on the object, the size and position of the object will not be re-calculated even if a property affecting it (such as font size) changes (so, for instance, if the font size is increased, clipping may occur). Basically, this means that normally only properties that do not affect the object's layout (such as text and background colors) should be changed in this script.
    See Also