Change Sub-Layer simple renderer


This sample only works with Image services sub-layers that are renderered using a simple renderer. The sample code searches for first ArcIMS Image service in the ArcMap document, and extracts the first simple renderered sub-layer symbol to set the control properties in the form, like: color, style, etc.

The sample covers:

How to use:
  1. Bring the VBA Editor from the Tools menu, under Macros (Alt+F11)
  2. Go to Tools, select References...
  3. Select the Microsoft XML, version 2.0 reference (msxml.dll)
  4. Bring the Customize dialog from the Tools menu in ArcMap.
  5. Select the Commands tab, and scroll down in Categories, select UIControls, save it in Untitled, and click New UIControl...
  6. The New UIControl use the default (UIButtonControl), and click Create and Edit button.
  7. Replace:
        Private Sub UIButtonControl1_Click()
        End Sub
        Private Sub UIButtonControl1_Click()
          ' ... Getting current twips per pixels
          If Not Main Then Exit Sub
          ' ... Show the form
          frmSimpleRendererSymbol.Show vbModal
        End Sub
        Private Function UIButtonControl1_Message() As String
          UIButtonControl1_Message = "Change IMS Sub-Layers Simple Symbology"
        End Function
        Private Function UIButtonControl1_ToolTip() As String
          UIButtonControl1_ToolTip = "IMS Sub-Layer Symbology"
        End Function
  8. From the VBA project explorer, right-click on Project project, and select Import File...
  9. Navigate to the ArcGIS installation directory, example: D:\arcgis\arcexe83\ArcObjects Developer Kit\Samples\IMS\Change Sub-Layer SimpleRenderer and add the following file: - frmSimpleRendererSymbol.frm - basHelper.bas
  10. Bring the Customize dialog again, select your Untitled document, select the UIControls in your Categories, and the Project.UIButtonControl1 should appear in your Commads list.
  11. Drag and drop the Project.UIButtonControl1 command into any Toolbar.
  12. Drag and drop the Project.UIButtonControl1 command into any Toolbar
  13. Add an Image service from your favorite site or visit the from the File menu, select Add Data from Geography Network.


Difficulty: Beginner

File Description
basHelper.bas Module that contains all the implementation for the command.
frmSimpleRendererSymbol.frm Form containing controls to change the symbol proterties.

Key CoClasses: ColorPalette, RgbColor
Key Interfaces: IMxDocument, IMap, IActiveView, ILayer, ICompositeLayer, IIMSMapLayer, IACMap, IACLayer, IACFeatureLayer, IIMSSubLayer, IACRenderer, IACGroupRenderer, IACSymbol, IACSimpleRenderer, IACSimpleMarkerSymbol, IACSimpleLineSymbol, IACSimpleFillSymbol, IACSimplePolygonSymbol, IColor, IColorPalette, IRgbColor