How To: Populate the SymbolSelector dialog
Instead of having default values and colors appear in the Symbol Selector dialog, you may want to populate the dialog with custom symbols, colors, and sizes.
- Start ArcMap.
- Create a new UIButtonControl: How To: Create a new UIButtonControl
Note: For more information on creating a UIControl, see the ArcGIS Desktop Help topic: 'Creating custom commands with VBA and UI Controls'
- Right-click the UIButtonControl and select View Source.
- Copy this code into the UIButtonControl's click event.
Code: Dim pSymbolSelector As ISymbolSelector Dim pMarkerIn As IMarkerSymbol Dim pMarkerOut As IMarkerSymbol Dim pSymbol As ISymbol Dim pColorIn As IRgbColor Dim pRGBColorOut As IRgbColor Set pMarkerIn = New CharacterMarkerSymbol Set pSymbolSelector = New SymbolSelector Set pColorIn = New RgbColor pColorIn.Red = 25 pColorIn.Green = 25 pColorIn.Blue = 150 pMarkerIn.Color = pColorIn pMarkerIn.Angle = 45 pMarkerIn.Size = 15 ' X and Y Offset values are not persisted. ' This is a known issue. ' pMarkerIn.XOffset = -5 ' pMarkerIn.YOffset = 2 pSymbolSelector.AddSymbol pMarkerIn If pSymbolSelector.SelectSymbol(0) Then ' The SymbolSelect Dialog popped up Set pSymbol = pSymbolSelector.GetSymbolAt(0) ' Capture the values set by the user Set pMarkerOut = pSymbol Set pRGBColorOut = pMarkerOut.Color Else MsgBox "User cancelled" End If
- Click the button to run the code.
Note: Values for the XOffset and YOffset propeties of the symbol object do not persist. This is a known issue.