Image Viewer Cells

General

A container, or Image Viewer, may contain a number of child windows called cells. These cells may contain images, tags or rulers. Cells are resized to fit within the "blocks" that make up the rows and columns in the container. The number of rows and columns can be altered programmatically by calling the SetContainerProperties method to set the container properties. The number of rows and columns can be altered dynamically by the user positioning more "splitters" within the container.

When a container is created, it is empty. To add a cell to a container, call the InsertCell method. The Window property(ILEADRasterContainerCell) is updated with a handle to the window of that cell.  The number of cells that can be added to a container is limited only by the available memory. The CellCount property contains the current number of cells in a container.

Cells are positioned within a container from left to right and top to bottom. When a cell is inserted in the container, any cells to the right of the inserted cell will be moved to the right one block, wrapping to the next row as each row is filled. The row and column position of each cell can be obtained in the ColumnPosition and RowPosition properties respectively. A cell can be repositioned, based on the index, by calling the RepositionCell method.

Each cell in the container has certain properties associated with it. The current properties for a cell can be retrieved or updated using the Cell property. There are certain properties that apply to all cells within a container. These properties can be retrieved and updated using GetContainerProperties and SetContainerProperties.

Each cell in a container has boundaries, which are dictated by the splitters separating the rows and the columns. These boundaries cannot actually be reset programmatically, although you could change the number of rows and columns in the container. The boundaries can be obtained however, by reading the following properties Left (ILEADRasterContainerCell), Top(ILEADRasterContainerCell), Width (ILEADRasterContainerCell) and Height(ILEADRasterContainerCell).

Actions may be applied to the images attached to the cells in the container. For more information about the available actions and the methods and properties associated with them, refer to Applying Actions to a Container. As the Applying Actions to a Container topic describes, actions can be assigned to mouse buttons and keystroke combinations. These actions are then applied to one or more cells when the mouse button is pressed/dragged or the keystroke combination is pressed. To prevent the mouse or keyboard from being used to apply an action to a cell, that cell can be frozen. To "freeze" a cell, set the Freeze property to TRUE. A frozen cell cannot be handled using the mouse or the keyboard, but it can be changed manually using the Cell property. To unfreeze a frozen cell, set the Freeze property to FALSE.

Cells within a container may be selected or deselected. In fact, when applying actions to cells the user has the option to apply the action on one cell, all cells, or only selected cells. To select or deselect a cell, set the Select property (ILEADRasterContainerCell). When selecting cells dynamically, selecting one cell by clicking on it will deselect all other cells. To select more than one cell, hold the CTRL key while clicking on the cells.

What a Cell Contains

A cell can have one or more images attached to it by calling the InsertBitmapList method. If a bitmap list having multiple images is added, scroll bars will appear to allow scrolling through the images. To get the current list attached to a cell, read the BitmapList Property. It is best not to modify an existing bitmap list attached to a specific cell. However, if it is necessary to modify an attached bitmap list, certain steps should be taken. For more information on this procedure, refer to InsertBitmapList.

Cells may also contain rulers. Horizontal and vertical rulers are used to measure the actual size of the image in centimeters. These rulers are updated automatically if the image is resized. They are displayed or hidden, depending on the cell attributes set using the Cell property. The style and colors used to draw the rulers are set for the container using SetContainerProperties.

In addition to images and rulers, cells may also contain tags. Tags are text that is spread along the sides of the cell, and provide information about the image. A cell may have no tags, one tag, or more than one tag. To display the tag(s) contained by a cell, set the ShowTags property to TRUE. Each tag is added by calling the AddTag method.

There are three types of tags:

image\sqrblit.gif Built-in tags (hot tags): internally written tags that contain information about the image, such as the scale. These tags change immediately, if the image properties associated with the tag change. Therefore, if the image is scaled to 300, the scale tag changes to 300.

image\sqrblit.gif User tags: tags that contain text entered by the user.

image\sqrblit.gif Owner tags: tags that are handled through the CellTag event. Each time a cell is drawn that contains an owner tag, this event is fired.

Sub-Cells

Cells can sometimes act like mini containers. They can be divided into equivalent blocks based on the number of rows and columns set using the SubRowCount and SubColumnCount properties. Splitters are not used to separate rows and columns in cells. Each block within the cell contains one page of the bitmap list attached to the cell. Scrolling is also supported within the cell, although it is a little different from the container scrolling. In cell scrolling, the pages shift up by one page. Therefore, if the cell has pages 0, 1, 2, and 3, and the pages are scrolled down by one, page 0 will disappear and page 1 will take its place.

There is very little independence for sub-cells. For most actions, such as scaling, if one sub-cell is scaled, all sub cells are scaled. However, the window leveling and alpha actions can be applied to individual sub-cells, without being applied to all sub-cells. depending on the value of the Individual property.

While sub-cells can be selected, only one-sub cell per cell can be selected at a time.

Dynamically, left double clicking on a sub-cell causes the cell to enter an "exploded" mode in which the sub-cell expands to cover the entire cell. Left double-clicking the cell a second time returns the sub-cell to its regular state.

Removing a Cell

When a cell is no longer needed in a container it can be removed by calling the RemoveCell method. If a cell is removed, any cells to the right of the removed cell will be shifted left. Cells will wrap to the preceding row as needed. All cells in a container can be removed by calling RemoveCell method with the lCellIndex parameter set to –1.

For a list of the properties, methods, and events used to manipulate the cell properties, refer to Image Viewer: Cell Properties.