User Tools

Site Tools


Table of Contents

CustomPaint sample

Documentation | Samples | CustomPaint


How to do custom drawings in a platform-independent way and how to assign renderer other than default and access its low-level API (like DC, Graphics).


DK allows using different renderers. For example .NET version is capable to draw using Graphics (GDI+) or SharpDX. This sample shows how to use methods called Canvas* (eg CanvasDrawText) to draw using same API independent of a platform, operating system etc. However, it is still possible to call low-level underlying graphics object. And this sample shows how to do this.

This sample illustrates use of:

Name Description
TGIS_ViewerWnd.RendererCurrently operating renderer.
TGIS_ViewerWnd.PaintExtraEventPaintExtra event.
TGIS_LayerVector.PaintShapeEventPaintShape event.
TGIS_RendererAbstract.CanvasPenPen of the Canvas object.
TGIS_RendererAbstract.CanvasBrushBrush of the Canvas object.
TGIS_RendererAbstract.CanvasDrawBitmapDraw bitmap on the Canvas object.
TGIS_RendererAbstract.CanvasDrawEllipseDraw an ellipse on the Canvas object.
TGIS_RendererAbstract.CanvasNativeReturn rendering context native to current renderer.
TGIS_RendererAbstract.CanvasDrawTextDraw a text on the Canvas object.
TGIS_GdipSolidBrush.createCreate a solid brush.
TGIS_GdipGraphics.FillRectangleFill a rectangle.
TGIS_GdipGraphics.DrawStringDraw a string.
TGIS_GdipGraphics.DrawImageDraw an image.
TGIS_GdipFont.CreateCreate a font.
TGIS_GdipStringFormat.CreateCreate a string format.


This sample is available on following platforms (click to see source code):

2018/06/21 15:44