API Documentation -> NtApplication -> NtGetIcon

# NtApplication.NtGetIcon Method

Whenever data objects shall be displayed as a icons (which technically are Bitmaps), the NtTimeChartControl needs to get the Bitmap for this object. So it will call this interface method to call your code. You will retreive the NtDataObject as a parameter. Your data is contained in the NtDataObject.dataItem member, so you can return the correct Bitmap to make up the icon.
This technology makes sense because in many cases the application does not store the icon within the data object itself. It rather stores a value (like a string) that allows the application to determine the correct icon.

Overload List:

Modifier / Return Value | Name and Parameters | Description
--- | --- | ---
Bitmap | NtGetIcon ( NtDataObject ntDo ) | For the data object given as parameter you will return the correct icon Bitmap.

Return value:

Bitmap
The icon that represents the object.

Parameters:

NtDataObject ntDo
The data object that the Time Chart wants to draw.

Remarks:

The Time Chart guarantees to only call this interface mamber for those objects that are defined to be represented as icons. For others that are to be drawn as strings, double values or Bitmaps with variable size, this method will never be called. This is important because you do not need to check the data type for these types. In other words, if all data objects that shall be drawn as icons are of the same type (e.g. strings) you can omit the casting completely.

Example:

Assume your application has a dictionary that contains the icons (in terms of Bitmaps) assigned to certain values that are string. Now your data is a set of strings. For each possible value that might occur an icon is in place. Then your implementation of NtGetIcon() might look like this:

public string NtGetBitmap(NtDataObject ntDo)
{
Bitmap b;
if(iconDictionary.TryGetValue((string)ntDo.dataItem, out b)) return b; }
return defaultIcon;
}

For more details please see the Concept Bitmaps and Icons and the Tutorial Bitmaps and Icons.

See also:

NtGetBitmap()
NtGetDouble()
NtGetText()

Top API Documentation -> NtApplication -> NtGetIcon © 2016 Bassaly