Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I´m developing in ArcGIS Engine and my question is how to draw a rectangle with INewRectangleFeedback interface. Here is my code but it does not create the rectangle. If someone could help me it would greatly appreciate it.

Public Sub mousedownFBRectanglePoly(ByVal px As Long, ByVal py As Long)

    feedbackStartPoint = New ESRI.ArcGIS.Geometry.Point
    feedbackMovePoint = New ESRI.ArcGIS.Geometry.Point
    feedbackScreenDisplay = Principal.m_mapControl.ActiveView.ScreenDisplay
    feedbackFillSymbol.Color.CMYK = RGB(255, 0, 0)

    'Initialize a new RectangleFB object
    NewRectangleFeedback = New NewRectangleFeedback
    NewRectangleFeedback.Display = feedbackScreenDisplay
    NewRectangleFeedback.Symbol = feedbackFillSymbol 'QI

    'pass the start point from the mouse position, transforming it to map coordinates.
    feedbackStartPoint = feedbackScreenDisplay.DisplayTransformation.ToMapPoint(px, py) 'QI
End Sub

Public Sub mousemoveFBRectanglePolygon(ByVal px As Long, ByVal py As Long)
    '    'pass X and Y to feedbackMovePoint to transfer to NewEnvelopeFeedback
    feedbackMovePoint = feedbackScreenDisplay.DisplayTransformation.ToMapPoint(px, py) 'QI
End Sub

Public Sub DoubleclickFBRectanglePolygon(ByVal px As Long, ByVal py As Long)
    'feedbackStopPoint = feedbackScreenDisplay.DisplayTransformation.ToMapPoint(px, py)
    'when mouse comes up, end the new envelope and pass it to feedbackEnvelope.
    feedbackRectangle = NewRectangleFeedback.Stop(feedbackStopPoint) 'QI
    'pass the new rectangle element, the geometry defined by our feedback object
    feedbackElement = New RectangleElement
    feedbackElement.Geometry = feedbackRectangle
    'make sure the element is activated in the current view
    'now add the newly created element to the ActiveView with default symbology.
    Principal.m_mapControl.ActiveView.GraphicsContainer.AddElement(feedbackElement, 0)
    'and refresh the view so we can see the changes.
End Sub

And also I have the problem that when I call my methods in the mouse events it does not enter the method; it skips even if all the parameters we pass are good.

share|improve this question

I made NewRectangleFeedback work with ArcGIS Desktop. Instead of using NewRectangleFeedback.SetPoint(), try using NewRectangleFeedback.MoveTo() in the MouseMove event handler. Additionally, it might be necessary to set the ROP2 property of the symbols (both the fill symbol and its outline symbol) to esriRasterOpCode.esriROPNotXOrPen. Finally, try simplify the geometry before using it with the graphic element. Hope that hepls.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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