API Documentation -> NtCustomObjectPaint -> NtPaintCustomObject

# NtCustomObjectPaint.NtPaintCustomObject Method

When you declare one or more data types to be drawn by your own code (this is called custom object drawing) then you need to implement this interface method. It is called by the NtTimeChartControl whenever drawing of one of the Display Objects is needed.

Overload List:

Modifier / Return Value | Name and Parameters | Description
--- | --- | ---
void | NtPaintCustomObject ( NtTimeChartControl ntTimeChartControl, NtDisplayObject displayObject, Rectangle objectRect, Rectangle paintRect, Graphics g ) | Implement this interface method to do the drawing of customizd objects.

Return value:

NtDisplayObject

Parameters:

NtTimeChartControl ntTimeChartControl
The NtTimeChartControl that does the call. Normally not used if you have only one NtTimeChartControl in your Form or application. But if you have more than one NtTimeChartControl and implement this interface only onece, this parameter might be helpful.

NtDisplayObject displayObject
The data object to create a NtDisplayObject for.

Rectangle objectRect
This rectangle is the bounding rectangle of your Display Object in client area coordinates of the NtTimeChartControl. This means that you can directly use these coordinates for drawing. For example if you want your Display Object to be a filled circle you can use this rectangle directly to draw the circle.

Rectangle paintRect
This rectangle is the area that actually needs painting. If the object has to be redrawn completely then this rectangle is the same as objectRect. But if your Display Object does not have to be drawn completely because it is partially out of the visible area or only a part of it needs to be redrawn due to overlapping with other windows or scrolling then paintRect is only a section of objectRect. In other words: objectRect comprises the complete object while paintRect comprises only that part that needs redrawing.

Graphics g
The Graphics object of the NtTimeChartControl. This can be helpful for calculating text boundaries and sizes so you do not need to create a Graphics object by yourself (which would be slow).

Remarks:

So why is the second rectangle paintRect needed at all? For example if your Display Object consist of an image to draw or a rectangle to fill it might be a huge saving in cpu power to reduce drawing as far as possible. Think of an image of 160 x 240 pixels. Drawing that completely is a certain effort. While on scrolling only a few lines might need drawing (which results in an area of 160 x 3 pixels e.g.). And if there are many objects affected then it might make the difference between fluid scrolling versus ugly scrolling if you take up the effort of advancing your programming towards only drawing the areas that really need drawing.

Top API Documentation -> NtTimeChartControl -> NtPaintCustomObject © 2016 Bassaly