Type | Description | |||
Alignment as VAlignmentEnum | A VAlignmentEnum expression that specifies the top or bottom side of the control. | |||
Long | A long expression that indicates the number of items locked to the top or bottom side of the control. |
The following VB sample displays some locked items to the top and bottom side of the control ( before running the sample, please make sure that the control contains some columns:
With Grid1 .BeginUpdate .DrawGridLines = exHLines .ShowLockedItems = True If .Columns.Count > 0 Then With .Items Dim h As EXGRIDLibCtl.HITEM, a As EXGRIDLibCtl.VAlignmentEnum a = exTop .LockedItemCount(a) = 2 h = .LockedItem(a, 0) .CellValue(h, 0) = "This is an item <b>fixed</b> to the top side of the control." .CellValueFormat(h, 0) = exHTML .ItemHeight(h) = 24 .ItemDivider(h) = 0 .ItemDividerLine(h) = EmptyLine h = .LockedItem(a, 1) .CellValue(h, 0) = "Total" .CellBold(h, 0) = True .CellValue(h, 1) = "$1000" .CellEditorVisible(h, 1) = False .CellHAlignment(h, 1) = RightAlignment a = exBottom .LockedItemCount(a) = 1 h = .LockedItem(a, 0) .CellValue(h, 0) = "This is an item <b>fixed</b> to the bottom side of the control." .CellValueFormat(h, 0) = exHTML .CellHAlignment(h, 0) = CenterAlignment .ItemHeight(h) = 24 .ItemDivider(h) = 0 .ItemDividerLine(h) = EmptyLine .ItemBackColor(h) = Grid1.BackColorHeader End With End If .EndUpdate End With
#include "Items.h" m_grid.BeginUpdate(); CItems items = m_grid.GetItems(); items.SetLockedItemCount( 0 /*exTop*/, 1); long i = items.GetLockedItem( 0 /*exTop*/, 0 ); COleVariant vtItem(i), vtColumn( long(0) ); items.SetCellValue( vtItem, vtColumn, COleVariant( "<b>locked</b> item" ) ); items.SetCellValueFormat( vtItem, vtColumn, 1/*exHTML*/ ); m_grid.EndUpdate();
The following VB.NET sample adds an item that's locked to the top side of the control:
With AxGrid1 .BeginUpdate() With .Items .LockedItemCount(EXGRIDLib.VAlignmentEnum.exTop) = 1 Dim i As Integer i = .LockedItem(EXGRIDLib.VAlignmentEnum.exTop, 0) .CellValue(i, 0) = "<b>locked</b> item" .CellValueFormat(i, 0) = EXGRIDLib.CaptionFormatEnum.exHTML End With .EndUpdate() End With
The following C# sample adds an item that's locked to the top side of the control:
axGrid1.BeginUpdate(); EXGRIDLib.Items items = axGrid1.Items; items.set_LockedItemCount(EXGRIDLib.VAlignmentEnum.exTop, 1); int i = items.get_LockedItem(EXGRIDLib.VAlignmentEnum.exTop, 0); items.set_CellValue(i, 0, "<b>locked</b> item"); items.set_CellValueFormat(i, 0, EXGRIDLib.CaptionFormatEnum.exHTML); axGrid1.EndUpdate();
The following VFP sample adds an item that's locked to the top side of the control:
with thisform.Grid1 .BeginUpdate() With .Items .LockedItemCount(0) = 1 .DefaultItem = .LockedItem(0, 0) .CellValue(0, 0) = "<b>locked</b> item" .CellValueFormat(0, 0) = 1 && EXGRIDLib.ValueFormatEnum.exHTML EndWith .EndUpdate() endwith