Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

AllowMergeFromUpper Property, CellBaseClass Class

Defines whether this cell is eligible to be used for cell merging by the cell above.

Class: CellBaseClass
Namespace: Softelvdm.Controls
Assembly: Softelvdm.SftTreeNET

Syntax

public BoolOptionalEnum AllowMergeFromUpper { get; set; }
Public Property AllowMergeFromUpper As BoolOptionalEnum

Value

True if this cell is eligible to be used for cell merging by the cell above, otherwise False.

The default value is BoolOptionalEnum.Default.

Comments

Defines whether this cell is eligible to be used for cell merging by the cell above.

For cell merging to take effect, the upper cell merging into this cell must have its CellBaseClass.EvaluatedMergeWithLower property set to True. The merged cell (this cell) must have its property CellBaseClass.EvaluatedAllowMergeFromUpper set to True to indicate that it is a candidate for cell merging. In addition, all cells involved in cell merging must either have the same cell text or all subordinate cells must be empty.

HeadersClass.AllowMergeFromUpperDefault for column headers, FootersClass.AllowMergeFromUpperDefault for column footers and ColumnClass.AllowMergeFromUpperDefault for each column.

The CellBaseClass.EvaluatedAllowMergeFromUpper property can be used to determine the actual status for this cell by evaluating the default settings.

Examples

C#

            sftTree1.MergeStyle = MergeStyleEnum.EmptyCells;

            // Merge all cells in the column header vertically (in the second column)
            // clear the text in all subordinate cells except for the first, main cell
            sftTree1.Headers.MaxLines = 4; // allow up to 4 text lines 
            for (int r = 0; r < sftTree1.Headers.Rows; ++r) {
                cell = sftTree1.Headers[r, 1];
                cell.MergeWithLower = BoolOptionalEnum.True;
                cell.AllowMergeFromUpper = BoolOptionalEnum.True;
                cell.Parts.Clear();
            }
            TextPartClass tp = new TextPartClass("Vertical");
            tp.Format |= StringFormatFlags.DirectionVertical;
            sftTree1.Headers[0, 1].Parts.Add(tp);
            sftTree1.Headers[0, 1].Parts.Add(new ImagePartClass(img));
            tp = new TextPartClass("Cell merging in\na column header");

VB.NET

    sftTree1.MergeStyle = MergeStyleEnum.EmptyCells

    ' Merge all cells in the column header vertically (in the second column)
    ' clear the text in all subordinate cells except for the first, main cell
    sftTree1.Headers.MaxLines = 4 ' allow up to 4 text lines 
    For r As Integer = 0 To sftTree1.Headers.Rows - 1
        cell = sftTree1.Headers(r, 1)
        cell.MergeWithLower = BoolOptionalEnum.True
        cell.AllowMergeFromUpper = BoolOptionalEnum.True
        cell.Parts.Clear()
    Next
    Dim tp As TextPartClass = New TextPartClass("Vertical")
    tp.Format = tp.Format Or StringFormatFlags.DirectionVertical
    sftTree1.Headers(0, 1).Parts.Add(tp)
    sftTree1.Headers(0, 1).Parts.Add(New ImagePartClass(img))
    tp = New TextPartClass("Cell merging in" & vbCrLf & "a column header")

See Also CellBaseClass Class | Classes | SftTree/NET 2.0