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

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

share|improve this question
up vote 2 down vote accepted

I would write a custom display feedback.

share|improve this answer
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.

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.