Gets or sets the top-level stacking rule for the document body.

The default value is BlockTopToBottom.

Namespace:  C1.C1Preview
Assembly:  C1.C1Report.2 (in C1.C1Report.2.dll)

Syntax

C#
[XmlAttributeAttribute("Stacking")]
[DefaultValueAttribute(StackingRulesEnum.BlockTopToBottom)]
public StackingRulesEnum Stacking { get; set; }
Visual Basic
<XmlAttributeAttribute("Stacking")> _
<DefaultValueAttribute(StackingRulesEnum.BlockTopToBottom)> _
Public Property Stacking As StackingRulesEnum
	Get
	Set

Remarks

The default value for this property is StackingRulesEnum.BlockTopToBottom.

Examples

The following example uses the Stacking property to set the stacking rule to BlockTopToBottom for the document:

Copy CodeVisual Basic
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    MakeDoc1(C1PrintDocument1)
    C1PrintDocument1.Generate()
End Sub
Private Function CreateObj(ByVal text As String) As C1.C1Preview.RenderObject
    Dim result As C1.C1Preview.RenderText = New C1.C1Preview.RenderText
    result.Text = text
    result.Style.Borders.All = New C1.C1Preview.LineDef("1mm", Color.Blue)
    result.Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Center
    result.Style.TextAlignVert = C1.C1Preview.AlignVertEnum.Center
    result.Style.BackColor = Color.LightSkyBlue
    result.CanSplitVert = False
    result.Width = "7cm"
    result.Height = "4cm"
    Return result
End Function
Private Sub MakeDoc1(ByVal doc As C1.C1Preview.C1PrintDocument)
    ' Title of the document.
    Dim rt As C1.C1Preview.RenderText = New C1.C1Preview.RenderText("Stacking and positioning of objects")
    rt.Style.Borders.Bottom = New C1.C1Preview.LineDef("1mm", Color.Black)
    doc.Body.Children.Add(rt)
    ' Document will contain the TOC.
    Dim toc As C1.C1Preview.RenderToc = New C1.C1Preview.RenderToc
    ' Demonstrate StackingRulesEnum.BlockTopToBottom.
    Dim title As C1.C1Preview.RenderText = New C1.C1Preview.RenderText("Demonstrates StackingRulesEnum.BlockTopToBottom stacking")
    title.BreakBefore = C1.C1Preview.BreakEnum.Page
    doc.Body.Children.Add(title)
    Dim area As C1.C1Preview.RenderArea = New C1.C1Preview.RenderArea
    area.Stacking = C1.C1Preview.StackingRulesEnum.BlockTopToBottom
    Dim i As Integer = 1
    While i <= 10
       area.Children.Add(CreateObj(String.Format("OBJECT {0}", i)))
       System.Math.Min(System.Threading.Interlocked.Increment(i), i - 1)
    End While
    doc.Body.Children.Add(area)
    toc.AddItem("Stacking", title, 1)
    toc.AddItem("StackingRulesEnum.BlockTopToBottom", title, 2)
    toc.AddItem("Positioning", title, 1)
    doc.Body.Children.Insert(1, toc)
End Sub
Copy CodeC#
private void Form1_Load(object sender, EventArgs e)
{
    MakeDoc1(c1PrintDocument1);
    c1PrintDocument1.Generate();
}
private RenderObject CreateObj(string text)
{
    C1.C1Preview.RenderText result = new C1.C1Preview.RenderText();
    result.Text = text;
    result.Style.Borders.All = new C1.C1Preview.LineDef("1mm", Color.Blue);
    result.Style.TextAlignHorz = C1.C1Preview.AlignHorzEnum.Center;
    result.Style.TextAlignVert = C1.C1Preview.AlignVertEnum.Center;
    result.Style.BackColor = Color.LightSkyBlue;
    result.CanSplitVert = false;
    result.Width = "7cm";
    result.Height = "4cm";
    return result;
}
private void MakeDoc1(C1.C1Preview.C1PrintDocument doc)
{
    // Title of the document.
    C1.C1Preview.RenderText rt = new C1.C1Preview.RenderText("Stacking and positioning of objects");
    rt.Style.Borders.Bottom = new C1.C1Preview.LineDef("1mm", Color.Black);
    doc.Body.Children.Add(rt);
    // Document will contain the TOC.
    C1.C1Preview.RenderToc toc = new C1.C1Preview.RenderToc();
    // Demonstrate StackingRulesEnum.BlockTopToBottom.
    C1.C1Preview.RenderText title = new C1.C1Preview.RenderText("Demonstrates StackingRulesEnum.BlockTopToBottom stacking");
    title.BreakBefore = C1.C1Preview.BreakEnum.Page;
    doc.Body.Children.Add(title);
    C1.C1Preview.RenderArea area = new C1.C1Preview.RenderArea();
    area.Stacking = C1.C1Preview.StackingRulesEnum.BlockTopToBottom;
    for (int i = 1; i <= 10; i++)
        area.Children.Add(CreateObj(string.Format("OBJECT {0}", i)));
    doc.Body.Children.Add(area);
    toc.AddItem("Stacking", title, 1);
    toc.AddItem("StackingRulesEnum.BlockTopToBottom", title, 2);
    toc.AddItem("Positioning", title, 1);
    doc.Body.Children.Insert(1, toc);
}

See Also