property Items.CellHAlignment ([Item as Variant], [ColIndex as Variant]) as AlignmentEnum
Retrieves or sets a value that indicates the alignment of the cell's caption.

 TypeDescription 
   Item as Variant A long expression that indicates the handle of the item.  
   ColIndex as Variant A long expression that indicates the column's index, a string expression that indicates the column's key or the column's caption.  
   AlignmentEnum An AlignmentEnum expression that indicates the alignment of the cell's caption.  
The CellHAlignment property aligns a particular cell. Use the Alignment property of the Column object to align all the cells in the column. Use the CellVAlignment property to align vertically the caption of the cell, when the item displays its content using multiple lines. Use the ClearCellHAlignment method to clear the cell's alignment previously set by the CellHAlignment property. If the CellHAlignment property is not set, the Alignment property of the Column object indicates the cell's alignment. Please make sure that If the cell belongs to the column that displays the hierarchy in the control ( TreeColumnIndex property indicates the index of the column that displays the hierarchy lines ),  the caption, icon or its picture can't be centered. In this case the caption can be aligned to the left or to the right. Use the RightToLeft property to align the drop down button to the left side of the control.

The following VB sample right aligns the focused cell:

With ComboBox1.Items
    .CellHAlignment(.FocusItem, 0) = AlignmentEnum.RightAlignment
End With

The following C++ sample right aligns the focused cell:

#include "Items.h"
CItems items = m_combobox.GetItems();
items.SetCellHAlignment( COleVariant( items.GetFocusItem() ), COleVariant( (long)0 ), 2 /*RightAlignment*/ );

The following VB.NET sample right aligns the focused cell:

With AxComboBox1.Items
    .CellHAlignment(.FocusItem, 0) = EXCOMBOBOXLib.AlignmentEnum.RightAlignment
End With

The following C# sample right aligns the focused cell:

axComboBox1.Items.set_CellHAlignment(axComboBox1.Items.FocusItem, 0, EXCOMBOBOXLib.AlignmentEnum.RightAlignment);

The following VFP sample right aligns the focused cell:

with thisform.ComboBox1.Items
	.DefaultItem = .FocusItem
	.CellHAlignment(0,0) = 2 && RightAlignment
endwith


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