Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

MergeStyle Property, SoftelvdmUserControl Class

Defines the cell merging style used by cells.

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

Syntax

public MergeStyleEnum MergeStyle { get; set; }
Public Property MergeStyle As MergeStyleEnum

Value

The merge style.

The default value is MergeStyleEnum.EmptyCells.

Comments

Defines the cell merging style used by cells.

The control's MergeStyle property determines whether empty cells or cells with the same cell text are candidates for cell merging, for vertical cell merging. Horizontal cell merging is always based on empty cells only.

Examples

C#

namespace WindowsApplication1 {
    public partial class MergeSample1 : Form {
        public MergeSample1() {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e) {
            // This sample demonstrates cell merging. In this sample, vertical merging
            // is based on empty subordinate cells (MergeStyle = MergeStyleEnum.EmptyCells).
            // To prepare for this sample, create a new project with a blank form and add
            // a SftTree/NET control named sftTree1.
            // In addition, adjust the following FromFile method to use a (small) bitmap
            // that is located on your system.
            Image img = Bitmap.FromFile("..\\..\\test.gif");
            CellClass cell;

VB.NET

    Dim item As ItemClass
    For i As Integer = 0 To 9
        item = sftTree1.ItemCollection.Add(New String() {"Text 0", "Text 1", "Text 2", "Text 3"})
        item.RowHeader.Text = "Row " & i.ToString()
    Next
    ' End of initialization

    ' In this sample, vertical merging is based on empty subordinate cells.
    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

See Also SoftelvdmUserControl Class | Classes | SftTree/NET 2.0