3

I want to change the symbol of features and legend programmatically. When I use this code

Dim pSymbolSelector As ISymbolSelector
Set pSymbolSelector = New SymbolSelector
Dim pMarker As ISimpleMarkerSymbol
Set pMarker = New SimpleMarkerSymbol
If Not pSymbolSelector.AddSymbol(pMarker) Then
 MsgBox "Could not add symbol"
ElseIf pSymbolSelector.SelectSymbol(0) Then
 Dim pSymbol As ISymbol
 Set pSymbol = pSymbolSelector.GetSymbolAt(0)
End If

then Symbol Selector is open, but when I select a symbol it is not being applied at the current layer in Table of Contents.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Aug 28, 2012 at 5:12

2 Answers 2

3

According to the ESRI documentation: "The SymbolSelector class is used for presenting the user with a choice of symbols: marker, line, fill, or text. The symbols in the selector are taken from the currently referenced style files."

If you want to handle this task programmatically, without user input, you can use IFeatureRenderer.

answered Aug 28, 2012 at 23:26
2
  • Thanks a lot for ur response...But when i run the above code it open Symbol selector of only single type it does not change it for polyline or polygon type featureclass.. it means it shows only point type symbols not for polyline and polygon type.what should i do for that.. Commented Aug 29, 2012 at 5:04
  • 2
    You're using 'ISimpleMarkerSymbol', which will give you a point marker. The code you posted is for point symbols, not line/polygon. IFeatureRenderer is still your best bet. Commented Aug 31, 2012 at 16:16
-1

You should use the interface ISimpleFillSymbol.

Kadir Şahbaz
78.6k57 gold badges260 silver badges407 bronze badges
answered Jul 27, 2021 at 4:26
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.