NtApplication.NtGetBitmap Method
Whenever a data object shall be displayed as a bitmap of flexible size, 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
This technology makes sense because in many cases the application does not store the bitmap within the data object itself. It rather stores a key (like the file path or URL) that allows the application to retrieve
the bitmap efficiently. But of course this retrieval can not be done by the Time Chart, it must be done by the application's code. So whenever the
Overload List:
| Modifier / Return Value | Name and Parameters | Description |
|---|---|---|
|
|
|
For the data object given as parameter you will return the correct Bitmap. |
Return value:
The Bitmap that represents the object.
Parameters:
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 Bitmaps. For others that are to be drawn as strings, double values or icons 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 Bitmaps are of the same type (e.g. strings that represent file paths) you can omit the casting completely.
Example:
One simple implementation looks like this:
This implementation is perfectly fine if the Bitmaps are not being reused among data objects. Once the
Still you can improve efficiency if several data objects share the same bitmap for display. Assume you create an application for a car rental company and in the Time Chart there is a row that shows car return events. When a car
is being returned, an image of that car is placed at the time stamp of the return. The data objects of type 'car return' do not hold the bitmap itself, of course. They hold the identifier of the car.
And as you may have many returns of the same car over time, the same bitmap is being used for many data objects. In this situation it now makes sense to implement a dictionary in your application that on startup
is filled with all car images linked to their identifiers. And in the method
For more details please see the Concept Bitmaps and Icons and the
Tutorial Bitmaps and Icons.
See also:
