Nateo Concepts -> Bitmaps and Icons

# Nateo Concept: Bitmaps and Icons

# Reusing Bitmaps and Icons

Icons and bitmaps are useful to represent certain values. Please think of a Time Chart that shows events in a car rental application. Then there might be a certain icon indicating the handover of a car to a customer, while another icon is used to indicate car returns. Then if within a certain time period fifty car return events take place then the application holds fifty data objects representing car returns. It can be easily understood that storing the icon once with each data object would be a waste of memory. Instead you better store icons in kind of a map and pick them according to the value of a data object.
Now how is this done by the NtTimeChartControl?
The NtTimeChartControl does not implement any mechanism by itself to maintain bitmaps. Instead it calls the interface method NtApplication.NtGetBitmap() or NtApplication.NtGetIcon() to call your application code, whenever a bitmap or icon is needed. It is then up to you to either load it from a file or pick it from a dictionary.
Taking a look into the NtApplication interface, we find two method definitions for handling Bitmaps and Icons:

Bitmap NtGetIcon(NtDataObject ntDo);
Bitmap NtGetBitmap(NtDataObject ntDo);

If you define the displayMethod of the NtDisplayDef for one of your data types to be 3 (bitmap) or 4 (icon) then the NtTimeChartControl automatically will call your implementation of these interface methods. Your code should return the appropriate icon or bitmap. It is totally up to you to implement the proper way of retrieving the very bitmap. For example if your data is set up in a way that the data object contains the file path to a bitmap, then you return that bitmap. Or if your data is set up in a way that for numeric values above 100 you return a red cross icon and for values below 100 you return a blue circle icon than that is also fine.
Please refer to the tutorial Bitmaps and Icons for a practical exercise.

<< Prev.: Condensed View Next: Courves >>

Top Concept Overview -> Bitmaps and Icons © 2016 Bassaly