So I want to allow the user to create a connection between 2 polygons on my map. So it doesn't make sense to allow them to draw polyline with multi points.

My question is, is there a way I can do something like below BUT ONLY with 1 start and 1 end point?

private IPolyline DrawLine(IActiveView activeView, int x, int y)
    IPolyline line = null;
    IRubberBand rubberBand = new RubberLineClass();
    ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();

    if (activeView != null)
        line = rubberBand.TrackNew(activeView.ScreenDisplay, (ISymbol)simpleLineSymbol) as IPolyline;

    return line;

Problem is i don't want the user to have to double click at the last point, it could be confusing for user, i want them to click - create start point, click - create end point.

Thanks, Kevin


I would write a custom display feedback.

  • right i manage to draw a line, now i can use the two points to create a polyline and put it in a feature layer. Thanks. – Kev84 Mar 30 '11 at 20:27

I would probably cheat and set up a mouse event handler, when its entered check to see if the tool is selected and then on the second click, raise another click. I'm sure Kirk's way is much better though.

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.