property Items.CellMerge([Item as Variant], [ColIndex as Variant]) as Variant
Retrieves or sets a value that indicates the index of the cell that's merged to. /*not supported in the lite version*/

 TypeDescription 
   Item as Variant A long expression that indicates the item's handle.  
   ColIndex as Variant A long expression that indicates the column's index, a string expression that indicates the column's caption or the column's key.  
   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 ItemDivider property to display a single cell in the entire item. Use the UnmergeCells method to unmerge the merged cells. Use the CellMerge property to unmerge a single cell. Use the MergeCells method to combine one or more cells in a single cell. Use the Add method to add new columns to the control. Use the LockedItemCount property to add or remove items locked to the top or bottom side of the control.

The following sample shows few methods to unmerge cells: 

You can merge the first three cells in the root item using any of the following methods:

The following VB sample merges the first three cells in the focused item:

With ComboBox1.Items
    .CellMerge(.FocusItem, 0) = 1
    .CellMerge(.FocusItem, 0) = 2
End With

The following C++ sample merges the first three cells in the focused item:

#include "Items.h"
CItems items = m_combobox.GetItems();
COleVariant vtItem( items.GetFocusItem() ), vtColumn( long( 0 ) );
items.SetCellMerge( vtItem, vtColumn, COleVariant( long(1) ) );
items.SetCellMerge( vtItem, vtColumn, COleVariant( long(2) ) );

The following VB.NET sample merges the first three cells in the focused item:

With AxComboBox1.Items
    .CellMerge(.FocusItem, 0) = 1
    .CellMerge(.FocusItem, 0) = 2
End With

The following C# sample merges the first three cells in the focused item:

axComboBox1.Items.set_CellMerge(axComboBox1.Items.FocusItem, 0, 1);
axComboBox1.Items.set_CellMerge(axComboBox1.Items.FocusItem, 0, 2);

The following VFP sample merges the first three cells in the focused item:

with thisform.ComboBox1.Items
	.DefaultItem = .FocusItem
	.CellMerge(0,0) = 1
	.CellMerge(0,0) = 2
endwith

In other words, the sample shows how to display the first cell using the space occupied by three cells.

 


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