Skip to content

CreateIconViewColumn Method

Description

Creates an icon column to be used in IconView (similar to the icon view in Explorer).

Syntax

Public Sub CreateIconViewColumn()

Remarks

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

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, but not 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 in BeforeDrawRow as you can read the record information to update the text/icon for the icon column item or use that information to perform other actions.

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.