property Items.LockedItemCount(Alignment as VAlignmentEnum) as Long
Specifies the number of items fixed on the top or bottom side of the control.

 TypeDescription 
   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.   
A locked or fixed item is always displayed on the top or bottom side of the control no matter if the control's list is scrolled up or down. Use the LockedItemCount property to add or remove items fixed/locked to the top or bottom side of the control. Use the LockedItem property to access a locked item by its position. Use the ShowLockedItems property to show or hide the locked items. Use the CellCaption property to specify the caption for a cell. Use the CountLockedColumns property to lock or unlock columns in the control. Use the ItemBackColor property to specify the item's background color. Use the ItemDivider property to merge the cells. Use the MergeCells method to combine two or multiple cells in a single cell.

The following VB sample adds two items that are locked to the top side of the control, and one item that's locked to the bottom side of the control:

With Gantt1
    Dim h As EXGANTTLibCtl.HITEM
    Dim a As EXGANTTLibCtl.VAlignmentEnum
    a = EXGANTTLibCtl.VAlignmentEnum.TopAlignment
    .BeginUpdate
    With .Items
        .LockedItemCount(a) = 2
        For i = 0 To .LockedItemCount(a) - 1
            h = .LockedItem(a, i)
            .CellCaption(h, 0) = "item <b>locked</b> to the top side of the control"
            .CellCaptionFormat(h, 0) = exHTML
            .ItemBackColor(h) = SystemColorConstants.vb3DFace
            .ItemForeColor(h) = SystemColorConstants.vbWindowText
        Next
        a = EXGANTTLibCtl.VAlignmentEnum.BottomAlignment
        .LockedItemCount(a) = 1
        h = .LockedItem(a, 0)
        .CellCaption(h, 0) = "item <b>locked</b> to the bottom side of the control"
        .CellCaptionFormat(h, 0) = exHTML
        .ItemBackColor(h) = SystemColorConstants.vb3DFace
    End With
    .EndUpdate
End With

The following C++ sample adds an item that's locked to the top side of the control:

#include "Items.h"
m_gantt.BeginUpdate();
CItems items = m_gantt.GetItems();
items.SetLockedItemCount( 0 /*TopAlignment*/, 1);
long i = items.GetLockedItem( 0 /*TopAlignment*/, 0 );
COleVariant vtItem(i), vtColumn( long(0) );
items.SetCellCaption( vtItem, vtColumn, COleVariant( "<b>locked</b> item" ) );
items.SetCellCaptionFormat( vtItem, vtColumn, 1/*exHTML*/ );
m_gantt.EndUpdate();

The following VB.NET sample adds an item that's locked to the top side of the control:

With AxGantt1
    .BeginUpdate()
    With .Items
        .LockedItemCount(EXGANTTLib.VAlignmentEnum.TopAlignment) = 1
        Dim i As Integer
        i = .LockedItem(EXGANTTLib.VAlignmentEnum.TopAlignment, 0)
        .CellCaption(i, 0) = "<b>locked</b> item"
        .CellCaptionFormat(i, 0) = EXGANTTLib.CaptionFormatEnum.exHTML
    End With
    .EndUpdate()
End With

The following C# sample adds an item that's locked to the top side of the control:

axGantt1.BeginUpdate();
EXGANTTLib.Items items = axGantt1.Items;
items.set_LockedItemCount(EXGANTTLib.VAlignmentEnum.TopAlignment, 1);
int i = items.get_LockedItem(EXGANTTLib.VAlignmentEnum.TopAlignment, 0);
items.set_CellCaption(i, 0, "<b>locked</b> item");
items.set_CellCaptionFormat(i, 0, EXGANTTLib.CaptionFormatEnum.exHTML);
axGantt1.EndUpdate();

The following VFP sample adds an item that's locked to the top side of the control:

with thisform.Gantt1
	.BeginUpdate()
		With .Items
			.LockedItemCount(0) = 1
			.DefaultItem = .LockedItem(0, 0)
			.CellCaption(0, 0) = "<b>locked</b> item"
			.CellCaptionFormat(0, 0) = 1 && EXGANTTLib.CaptionFormatEnum.exHTML
		EndWith
	.EndUpdate()
endwith

 


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