<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: I need help to change the selected feature color to red in C# in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/i-need-help-to-change-the-selected-feature-color/m-p/1066758#M20325</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;At first you can't cast from IFeature to IFeatureSelection. You can cast&amp;nbsp; IFeatureLayer to IFeatureSelection.&lt;/P&gt;&lt;P&gt;So it would be:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;IFeatureSelection featureSelection = pFeatureLayer as IFeatureSelection;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you look at your layer Properties-Selection tab you will find options on showing selection:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GintautasKmieliauskas_0-1623303882562.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/15596i321E46F2D4D29B9C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GintautasKmieliauskas_0-1623303882562.png" alt="GintautasKmieliauskas_0-1623303882562.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The first one is ArcMap setting which changes all layers selection showing. I think you don't want to change all layers selection to red. If you do then you&amp;nbsp;should use SelectionColor on IMapDescription2.&lt;/P&gt;&lt;P&gt;If you are interesting in third option then you should use SelectionColor on ILayerDescription.&lt;/P&gt;&lt;P&gt;More info about both cases here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#ILayerDescription_SelectionColor.htm" target="_blank"&gt;- ILayerDescription.SelectionColor Property (ArcObjects .NET 10.8 SDK) (arcgis.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you want mark one special from selection you can use&amp;nbsp;IGraphicsContainer to draw graphic element on top of your feature with color or shape you want.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Jun 2021 05:58:43 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2021-06-10T05:58:43Z</dc:date>
    <item>
      <title>I need help to change the selected feature color to red in C#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/i-need-help-to-change-the-selected-feature-color/m-p/1066695#M20324</link>
      <description>&lt;P&gt;IFeatureLayer pFeatureLayer;&lt;/P&gt;&lt;P&gt;IFeatureCursor pFeatureCursor;&lt;BR /&gt;IQueryFilter pQueryFilter;&lt;BR /&gt;ESRI.ArcGIS.Geodatabase.IFeature pFeature;&lt;BR /&gt;pFeatureLayer = this.axMapControl1.Map.get_Layer(0) as IFeatureLayer;&lt;BR /&gt;if (pFeatureLayer.Name != "parcel")&lt;BR /&gt;return;&lt;BR /&gt;this.axMapControl1.Map.ClearSelection();&lt;BR /&gt;pQueryFilter = new QueryFilterClass();&lt;BR /&gt;&lt;BR /&gt;pQueryFilter.WhereClause = "cc_number='LEKMA'";&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;pFeatureCursor = pFeatureLayer.Search(pQueryFilter, true);&lt;BR /&gt;pFeature = pFeatureCursor.NextFeature();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;IFeatureSelection featureSelection = pFeature as IFeatureSelection;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;if (pFeature != null)&lt;BR /&gt;{&lt;BR /&gt;this.axMapControl1.Map.SelectFeature(pFeatureLayer, pFeature);&lt;BR /&gt;this.axMapControl1.Extent = pFeature.Shape.Envelope;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show("Not found" + "LEKMA");&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 22:59:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/i-need-help-to-change-the-selected-feature-color/m-p/1066695#M20324</guid>
      <dc:creator>worlanyo</dc:creator>
      <dc:date>2021-06-09T22:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: I need help to change the selected feature color to red in C#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/i-need-help-to-change-the-selected-feature-color/m-p/1066758#M20325</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;At first you can't cast from IFeature to IFeatureSelection. You can cast&amp;nbsp; IFeatureLayer to IFeatureSelection.&lt;/P&gt;&lt;P&gt;So it would be:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;IFeatureSelection featureSelection = pFeatureLayer as IFeatureSelection;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you look at your layer Properties-Selection tab you will find options on showing selection:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GintautasKmieliauskas_0-1623303882562.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/15596i321E46F2D4D29B9C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GintautasKmieliauskas_0-1623303882562.png" alt="GintautasKmieliauskas_0-1623303882562.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The first one is ArcMap setting which changes all layers selection showing. I think you don't want to change all layers selection to red. If you do then you&amp;nbsp;should use SelectionColor on IMapDescription2.&lt;/P&gt;&lt;P&gt;If you are interesting in third option then you should use SelectionColor on ILayerDescription.&lt;/P&gt;&lt;P&gt;More info about both cases here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#ILayerDescription_SelectionColor.htm" target="_blank"&gt;- ILayerDescription.SelectionColor Property (ArcObjects .NET 10.8 SDK) (arcgis.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you want mark one special from selection you can use&amp;nbsp;IGraphicsContainer to draw graphic element on top of your feature with color or shape you want.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 05:58:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/i-need-help-to-change-the-selected-feature-color/m-p/1066758#M20325</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2021-06-10T05:58:43Z</dc:date>
    </item>
  </channel>
</rss>

