Using the ChSelectionCollection Collection
You use the SelectionCollection property to retrieve the selection list. The SelectionCollection property of the ChartSpace object (for example,
ChartSpace1.SelectionCollection) returns a ChSelectionCollection collection that contains all selected objects in a chart, including both primary and secondary selections.
The primary selection is the first item in this collection.
Any additional items are secondary selections, which can only be ChPoint objects. This collection always contains at least one item, which is the primary selection. The object returned by
ChartSpace1.SelectionCollection(0) is the same object that is returned by the Selection property of the ChartSpace object (for example,
ChartSpace1.Selection). The ChSelectionCollection collection can only be populated by using the Select2 method, for example,
Multiple items cannot be selected in the user interface of the Chart component. Items must be added to or removed from a selection programmatically. To capture multiple selections when a user clicks on a chart, you must monitor the mouse move and mouse button events and identify the items being selected using the RangeFromPoint method of the ChartSpace object. To prevent the built-in selection handling behavior of the Chart component from interfering with programmatic tracking of multiple selections, you must make sure that the AllowUISelection property of the ChartSpace object is set to False.
You use the Item property to return a single selected object from the ChSelectionCollection collection. Individual objects in the ChSelectionCollection collection are indexed beginning with 0 for the first object, 1 for the second object, and so forth. You use the Count property to return the number of items in the ChSelectionCollection collection. The Parent property returns the parent object, which is the ChartSpace object in this case.
The ChSelectionCollection collection has no methods.