This documentation is for the old version. Go to the latest Graphics Mill docs

Using Working Areas

Beside other features, ThumbnailListView supports working areas. Working areas are rectangular virtual areas that the control uses to arrange items. A working area is not a window and cannot have a visible border. By default, the control has no working areas. By creating a working area, you can arrange the items in a non-standard way or cause a horizontal scroll bar to be displayed when there normally would not be one.

When to Use Working Areas

Using working areas makes sense only when the thumbnail or icon view is used to display items. Another precondition is when the default item layout is not suitable for your needs. By default, items are organized in rows from left to right and from the top to the bottom. If you want to change this layout, use working areas.

Placing an item to a working area affects only item position in the control, and nothing more. You may have several working areas in your control, but you should think in advance if such layout will be convenient and intuitive.

Adding Items to Working Areas

Let us look how a working area can be useful when you want to organize the thumbnails in a film strip.

This will be pretty easy, as you will only need to:

  • Make sure you use the thumbnail or icon view.
  • Create a working area wide enough to contain all thumbnails or icons.
  • Add items to the defined working area, as soon as you add them to the item list of the control.

To ensure that the working area will be able to contain all items, you can, for example, set its width to the value of the IconSpacing property multiplied by the number of elements in the strip. If you create a list of files in a local folder, you can get the number of elements that will be placed in the strip from the PIDL (pointer to an item identifier list) you are working with. For more details on working with PIDLs, see the Using the ThumbnailListView Control as a File Browser topic.

Here is an example of creating a film strip for one particular folder.

Visual Basic
'Create a PIDL
        Dim pidl As Aurigma.GraphicsMill.WinControls.Pidl = Aurigma.GraphicsMill.WinControls.Pidl.Create("C:\Documents and " & _
 "Settings\All Users\Documents\My Pictures\Sample Pictures")

'Set the thumbnail view
ThumbnailListView1.View = Aurigma.GraphicsMill.WinControls.View.Thumbnails

'Add necessary working areas
Dim areas() As Rectangle = {New Rectangle(0, 5, _
    ThumbnailListView1.IconSpacing.X * pidl.Items.Length, _
    ThumbnailListView1.IconSpacing.Y)}
ThumbnailListView1.WorkAreas = areas

'Clear all previously displayed items
ThumbnailListView1.Items.Clear()

Dim itemIndex As Integer = 0

'Add each item in the folder to the thumbnail list
For Each subPidl As Aurigma.GraphicsMill.WinControls.Pidl In pidl.Items
    ThumbnailListView1.Items.Add(New _
        Aurigma.GraphicsMill.WinControls.ThumbnailListItem(subPidl))

    'Move the added item to a required working area
    ThumbnailListView1.MoveItemToWorkArea(itemIndex, 0)
    itemIndex = itemIndex + 1
Next
C#
//Create a PIDL
Aurigma.GraphicsMill.WinControls.Pidl pidl =
    Aurigma.GraphicsMill.WinControls.Pidl.Create(@"C:\Documents and Settings" +
    @"\All Users\Documents\My Pictures\Sample Pictures");

//Set the thumbnail view
thumbnailListView1.View = Aurigma.GraphicsMill.WinControls.View.Thumbnails;

//Add necessary working areas
Rectangle [] areas = {new Rectangle(0, 5, thumbnailListView1.IconSpacing.X * 
    pidl.Items.Length, thumbnailListView1.IconSpacing.Y)};
thumbnailListView1.WorkAreas = areas;

//Clear all previously displayed items
thumbnailListView1.Items.Clear();

int itemIndex = 0;

//Add each item in the folder to the thumbnail list
foreach (Aurigma.GraphicsMill.WinControls.Pidl subPidl in pidl.Items)
{
    thumbnailListView1.Items.Add(new
        Aurigma.GraphicsMill.WinControls.ThumbnailListItem(subPidl));

    //Move the added item to a required working area
    thumbnailListView1.MoveItemToWorkArea(itemIndex, 0);
    itemIndex++;
}

See Also

Reference

Manual