Skip to content

AddIcon Method

Description

Used to add an icon to the ImageManagerIcons collection of icons from the handle of the icon.

Syntax

Public Sub AddIcon( _
    ByVal [Handle](#) As Long, _
    ByVal [Command](#) As Long, _
    ByVal [imageState](#) As [XTPImageState](XtremeCalendarControl~Enumerations~XTPImageState_EN.md) _
)

Parameters

  • Handle: The handle to the icon to be added.
  • Command: The ID that will be used to identify the icon in the collection of icons. This can be any positive (non-zero) number.
  • imageState: The state of the image.

Image States

Value Description
xtpImageNormal Specifies a normal icon. This is the image displayed when the item is displayed normally.
xtpImageDisabled Specifies a disabled icon. This is the image displayed when the item is disabled.
xtpImageHot Specifies a hot icon. This is the image displayed when the mouse pointer is positioned over the item.
xtpImageChecked Specifies a "checked" or selected icon. This is the image displayed when the item is in a selected state.
xtpImagePressed Specifies a "pressed" or pushed icon. This is the image displayed when the item is currently pressed by the mouse cursor.

Remarks

The "Command" parameter can be any positive integer and is used to identify the icon in the collection of icons. When you want to use an icon, you need to specify this value. To use the icon, you would assign the "Command" value to the Icon property of the GridColumn and GridRecordItem objects.

Only the "Normal" icon is used in the GridControl. You can add "Hot" and "Disabled" icons, but they will not be used.

Example

Adding an Icon using the AddIcon method (Visual Basic)

This sample illustrates how to add an icon to the GridControl using the AddIcon method.

' Add this to the General code section  
Const COLUMN_CHECK = 0  

' This code is placed in the Form_Load event  
Dim Column As GridColumn  
Set Column = wndGridControl.Columns.Add(COLUMN_CHECK, "Selected", 18, False)  
Column.Icon = 105  

Dim hIcon As IPictureDisp  

' Only the "Normal" state icon is used in the Grid control  
Set hIcon = ImageListGrid.ListImages(1).ExtractIcon  
wndGridControl.Icons.AddIcon hIcon, 105, xtpImageNormal  

See Also


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