Click or drag to resize

IJamShellColumnCollectionAdd Method (JamShellColumnHeader)

Adds the specified JamShellColumnHeader to the collection.

Namespace:  Jam.Shell
Assembly:  ShellBrowser (in ShellBrowser.dll) Version: 7.1
Syntax
int Add(
	JamShellColumnHeader pHeader
)

Parameters

pHeader
Type: Jam.ShellJamShellColumnHeader
The JamShellColumnHeader to add.

Return Value

Type: Int32
The position the column was added at.
Examples
This example adds custom columns in the CreatedColumns event.
C#
private void ShellListView_CreatedColumns(object sender, EventArgs e)
{
    // add a column for the path length
    JamShellColumnHeader lCol = new JamShellColumnHeader();
    lCol.Text = cPathLengthString;
    lCol.TextAlign = HorizontalAlignment.Right;
    lCol.Width = 85;
    shellListView1.Columns.Add(lCol);
    lCol.DisplayIndex = 1; //if you want a different position for your column use the DisplayIndex.



    // add a column for the link target
    lCol = new JamShellColumnHeader();
    lCol.Text = cLinkTargetString;
    // the link target is a full path so we need a large column
    lCol.Width = 350;
    shellListView1.Columns.Add(lCol);
}

private void ShellListView_AddItem(object sender, Jam.Shell.AddItemEventArgs e)
{
    //The AddItem is called for every item that is added to the list. You need to provide values for the custom columns.
    //Add the subitems in the same order the columns were added (the index of column and subItems must match).

    // get the path length
    string lLength = e.Item.FullPath.Length.ToString(System.Globalization.CultureInfo.CurrentCulture);
    // add the path length as subitem
    e.Item.SubItems.Add(lLength);

    // check whether the item is a link
    // note: the next few lines are just used for illustrative purposes.
    // the retrieval of the link target may take some time for large file lists
    string lLinkTarget = ShellBrowser.GetLinkTarget(e.Item.FullPath);
    // add the link target as subitem (if it`s not a link, an empty string was returned)
    e.Item.SubItems.Add(lLinkTarget);
}
See Also