Skip to content

IconViewSetup Method

Description

Specifies from which column to display text in IconView. It also specifies the icon used for all items in IconView.

Syntax

Public Sub IconViewSetup( _
    ByVal [ColumnIndex](#) As Integer, _
    ByVal [IconIndex](#) As Integer _
)

Parameters

  • ColumnIndex
    Column from which to display the caption data in IconView.

  • IconIndex
    Index of an icon in the image manager to display for all items in IconView. See description below on how to change icons for individual items.

Remarks

The grid's Icon View is similar to the icon view in Windows Explorer. CreateIconViewColumn is used to create a separate icon column that is distinct from the other columns in the grid. This icon column will remain hidden until IconView is used to display it. All normal columns are hidden when the icon column is displayed; you need to use IconView to display either the icon column or the normal columns; you can't display both at the same time.

You can display text under each icon in the icon column. To do this, you would use the IconViewSetup method to choose from which normal column text will be displayed. The IconViewSetup method is also used to specify which icon from the image manager should be displayed for all items in the icon column. This will use the specified icon for each item in the icon column. You can override the default icon using BeforeDrawRow.

Another great feature of using BeforeDrawRow is that you can access all records associated with the current icon view item. This proves very useful when in BeforeDrawRow as you can read the record information to update the text/icon for the icon column item or use that information to do something else.

CreateIconViewColumn is automatically called internally when calling IconViewSetup. You only need to call CreateIconViewColumn if you choose not to use IconViewSetup.

Example

wndGridControl.ShowGroupBox = False  
wndGridControl.GroupsOrder.DeleteAll  

wndGridControl.CreateIconViewColumn  
wndGridControl.IconViewSetup 3, COLUMN_IMPORTANCE_ICON  
wndGridControl.IconView = True

Private Sub wndGridControl_BeforeDrawRow(ByVal Row As XtremeGridControl.IGridRow, ByVal Item As XtremeGridControl.IGridRecordItem, ByVal Metrics As XtremeGridControl.IGridRecordItemMetrics)  
    If wndGridControl.IconView Then  
        If Not Row.GroupRow Then  
            Metrics.ItemIcon = Row.Record(1).Icon  
        End If  
    End If
End Sub

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.