1

I have a problem you want help:

enter image description here

In ArcMap 10.2.2

enter image description here

In my code I want to highlight selections but I can't.

My code:

void drawPoint(IFeature pfeature)
{
  IRgbColor rgbColor = new RgbColorClass();
  rgbColor.Red = 255;
  rgbColor.Blue = 0;
  rgbColor.Green = 0;

  IMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol();
  simpleMarkerSymbol.Color = rgbColor;// color RED
  simpleMarkerSymbol.Size = 15;
  IMarkerElement markerElement = null;

  markerElement = new MarkerElementClass();
  markerElement.Symbol = simpleMarkerSymbol;
  IGraphicsContainer graphicsContainer =
  GeneralVariableMap.mapControl.Map as IGraphicsContainer;
  IElement element = null;
  element = (IElement)markerElement;
  element.Geometry = pfeature.Shape;
  graphicsContainer.AddElement(element, 0);
}
1

Maybe you only have to refresh the map. Don't know what is GeneralVariableMap. Usually I do sth like this:

mxDocument.ActivatedView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

Another idea (not tested):

void drawPoint(IFeature pfeature)
{
  IRgbColor rgbColor = new RgbColorClass();
  rgbColor.Red = 255;
  rgbColor.Blue = 0;
  rgbColor.Green = 0;

  IMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol();
  simpleMarkerSymbol.Color = rgbColor;// color RED
  simpleMarkerSymbol.Size = 15;

  IElement element = new MarkerElementClass();
  IMarkerElement markerElement =(IMarkerElement)element;

  markerElement.Symbol = simpleMarkerSymbol;
  IGraphicsContainer graphicsContainer =
  GeneralVariableMap.mapControl.Map as IGraphicsContainer;

  element.Geometry = pfeature.Shape;
  graphicsContainer.AddElement(element, 0);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.