property Items.CellMerge(Index as Long, ColIndex as Variant) as Variant
Retrieves or sets a value that indicates the index of the cell that's merged to.

 TypeDescription 
   Index as Long A long expression that indicates the index of the item where cells are merged.  
   ColIndex as Variant A long expression that indicates the column's index  
   Variant A long expression that indicates the index of the cell that's merged with, a safe array that holds the indexes of the cells being merged.  
Use the CellMerge property to combine two or more cells in the same item in a single cell. The data of the source cell is displayed in the new larger cell. All the other cells' data is not lost. Use the CellMerge property to unmerge a single cell. Use the Add method to add new columns to the control. Use the Caption property to specify the caption of the cell. Use the SelectableItem property to specify whether the user can select an item. Use the BeginUpdate and EndUpdate methods to prevent control from painting while adding columns and items.

The following VB sample merges first three cells in a single one:

With List1.Items
    .CellMerge(.FirstVisibleItem, 0) = 1
    .CellMerge(.FirstVisibleItem, 0) = 2
End With

or

With List1.Items
    .CellMerge(.FirstVisibleItem, 0) = Array(1, 2)
End With

The following VB sample unmerges the first visible cell:

With List1.Items
    .CellMerge(.FirstVisibleItem, 0) = -1
End With

The following C++ sample merges first three cells in a single one:

CItems items = m_list.GetItems();
items.SetCellMerge( items.GetFirstVisibleItem(), COleVariant( long(0) ), COleVariant( long(1) ) );
items.SetCellMerge( items.GetFirstVisibleItem(), COleVariant( long(0) ), COleVariant( long(2) ) );

The following VB.NET sample merges first three cells in a single one:

With AxList1.Items
    .CellMerge(.FirstVisibleItem, 0) = 1
    .CellMerge(.FirstVisibleItem, 0) = 2
End With

or

With AxList1.Items
    Dim m() As Integer = {1, 2}
    .CellMerge(.FirstVisibleItem, 0) = m
End With

The following C# sample merges first three cells in a single one:

axList1.Items.set_CellMerge(axList1.Items.FirstVisibleItem, 0, 1);
axList1.Items.set_CellMerge(axList1.Items.FirstVisibleItem, 0, 2);

or

int[] m = {1,2};
axList1.Items.set_CellMerge(axList1.Items.FirstVisibleItem, 0, m);

The following VFP sample merges first three cells in a single one:

with thisform.List1.Items
	.CellMerge(.FirstVisibleItem,0) = 1
	.CellMerge(.FirstVisibleItem,0) = 2
endwith

 

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.