This document is archived and information here might be outdated.  Recommended version.


Managing custom feature renderers (ArcObjects .NET 10.4 SDK)

Managing custom feature renderers


In this topic


Applying custom feature renderers to a layer

Custom feature renderers are simple to manage, and they usually require the dynamic-link library (DLL) containing the renderer class to be registered on each client PC.
The main methods for applying a custom feature renderer to a layer are as follows:
  • From the Symbology tab on the Layer Properties dialog box (ArcGIS for Desktop only)
  • From the client ArcObjects code
  • Via a feature class extension

Applying through the Layer Properties dialog box (ArcGIS for Desktop only)

Applying the renderer through the Layer Properties dialog box requires you to implement a custom renderer property page registered to the Esri Renderer Property Pages component category.

Applying with ArcObjects code

Applying your custom renderer with ArcObjects code is the usual method when you have not implemented a custom renderer property page. The following code example creates a point dispersal renderer object, then replaces an existing renderer in a particular layer:
[VB.NET]
' geoFeatureLayer is an interface pointer to the IGeoFeatureLayer
' interface on a Feature Layer object.

' Create the custom renderer.
Dim myRenderer As IDispersalRenderer
myRenderer=New PointDispersalVB.Renderer
' Set properties.

' Set the custom renderer into the feature layer.
geoFeatureLayer.Renderer=myRenderer
mxDocument.ActiveView.Refresh()
mxDocument.UpdateContents()
[C#]
// geoFeatureLayer is an interface pointer to the IGeoFeatureLayer
// interface on a feature layer object.

// Create the custom renderer.
IDispersalRenderer myRenderer;
myRenderer=new PointDispersalVB.Renderer();
// Set properties.

// Set the custom renderer into the feature layer.
geoFeatureLayer.Renderer=myRenderer;
mxDocument.ActiveView.Refresh();
mxDocument.UpdateContents();
A custom renderer without an accompanying property page can be applied programmatically.

Applying with a feature class extension

The third way of applying a custom renderer to a layer is by writing a feature class extension. Your class extension must implement IFeatureClassExtension and IFeatureClassDraw.
To summarize, the globally unique identifier (GUID) of the FeatureClassExtension object is stored as an entry in the geodatabase. When the layer for this feature class draws, it looks to the feature class extension and uses the defined renderer (IFeatureClassDraw.CustomRenderer), which can be a custom renderer or one of the standard Esri renderers. You can also associate a custom renderer property page through IFeatureClassDraw.CustomRendererPropertyPageCLSID. To prevent users from changing the renderer, return true from IFeatureClassDraw.ExclusiveCustomRenderer.
Custom renderers can be applied by feature class extensions that implement IFeatureClassDraw.


See Also:

Creating custom feature renderers
Samples:




Development licensing Deployment licensing
ArcGIS for Desktop Basic ArcGIS for Desktop Basic
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced
Engine Developer Kit Engine