User Tools

Site Tools


samples:samples:paintlabel

Table of Contents

PaintLabel sample

Documentation | Samples | PaintLabel

Summary

PaintLabel sample — demonstrates customizing label rendering and appearance (Delphi/VCL).

Description

What the sample shows:

  • Loading a shapefile layer (countries/cities) with predefined labels
  • Implementing custom label painting via OnPaintShapeLabel event handler
  • Modifying label text dynamically based on feature attributes
  • Customizing label font, size, color, and style per feature
  • Adding custom icons or symbols alongside labels
  • Controlling label positioning and offset from feature geometry
  • Filtering labels based on zoom level or feature attributes
  • Adding borders, outlines, or shadows to label text
  • Handling label collision detection and placement
  • Rotating labels to match feature orientation (e.g., road labels)
  • Using TGIS_PaintShapeLabelEventArgs to access rendering context

This sample illustrates use of:

Name Description
TGIS_Layer.ParamsParameters (colors, fills, etc.) object.
TGIS_LayerVector.PaintShapeLabelEventFired to perform custom drawing for labels of individual shapes.
TGIS_Shape.GetFieldReturns the current shape field value, substituting the field default when the stored value is NULL.

Code

This sample is available on the following platforms (click to view the source code on GitHub):

2026/07/05 05:38

Page Tools