Hollow square must be removed

How to remove the hollow square that appears after selection of any link. I'm using golabellink. Here is the screen shot for the same. Please help me in removing or making invisible only the hollow square.
Note:Currently all links can be relinked to other nodes. i.e., can be manually dragged and link to other node. This functionality shouldn't be disturbed.

[code] [Serializable]
public class NoResizeHandlesLabeledLink : GoLabeledLink {
public NoResizeHandlesLabeledLink() { }

public override GoLink CreateRealLink() {
  return new NoResizeHandlesLink();
}

}

[Serializable]
public class NoResizeHandlesLink : GoLink {
public NoResizeHandlesLink() {
this.Orthogonal = true;
this.ToArrow = true;
}

public override void AddSelectionHandles(GoSelection sel, GoObject selectedObj) {
  // somewhat wasteful: create all selection handles as normal, ...
  base.AddSelectionHandles(sel, selectedObj);
  // and then remove the intermediate ones, while leaving the two handles used for relinking
  foreach (IGoHandle h in sel.GetHandleEnumerable(this)) {
    if (h.HandleID != GoLink.RelinkableFromHandle && h.HandleID != GoLink.RelinkableToHandle) {
      h.GoObject.Remove();
    }
  }
}

}[/code]

Thanks for your reply.

On using the code, the result was something like the snapshot, which is not I'm expecting. I don't want any boxes to appear in between. There can be only two boxes or diamonds, which is on either end of the line.

The code I posted works well for me. Are you sure you are using GoLabeledLinks that contain NoResizeHandleLinks with that method override?

Hi Walter,
I’m using the same code that was sent by you, with the override method. Can u send me a snapshot of how exactly the ouput comes for you.
And is there any other way of implementing the same apart for the one provided?
Thanks.

I just created a bunch of different kinds of nodes, linked them together, and then selected everything. I had set GoView.NewLinkClass = typeof(NoResizeHandlesLabeledLink).

Yes, I’m sure there are other ways of implementing the same behavior. But what’s wrong with the one I provided? There’s just an override of GoObject.AddSelectionHandles, which is simple and clear.

Hi walter,
I tried, but still unable to succeed. I don't know where am i going wrong.
Sorry for the trouble. While working on the same, I was able to achieve as shown in the snapshot. The snapshot provided shows the highlight of line and shapes. But, I'm unable to resize the line with this. By setting HighlightWhenSelected =true and HighlightPen, this can be achieved and seems to be a good solution for my problem, but i want to resize the line or link the line to different shapes. How to do that?

[code] [Serializable]
public class NoResizeHandlesLink2 : GoLink {
public NoResizeHandlesLink2() {
this.ToArrow = true;
this.Orthogonal = true;
this.HighlightPen = new Pen(Color.HotPink, 5);
this.HighlightWhenSelected = true;
}

public override void AddSelectionHandles(GoSelection sel, GoObject selectedObj) {
  RemoveSelectionHandles(sel);
  if (this.PointsCount == 0) return;

  if (this.HighlightWhenSelected) {
    bool oldskips = this.SkipsUndoManager;
    this.SkipsUndoManager = true;
    this.Highlight = true;
    this.SkipsUndoManager = oldskips;
  }

  if (this.Relinkable) {
    PointF pnt = GetPoint(this.FirstPickIndex);
    IGoHandle handle = sel.CreateResizeHandle(this, selectedObj, pnt, RelinkableFromHandle, true);
    MakeRelinkingHandle(handle);

    pnt = GetPoint(this.LastPickIndex);
    handle = sel.CreateResizeHandle(this, selectedObj, pnt, RelinkableToHandle, true);
    MakeRelinkingHandle(handle);
  }
}

private static void MakeRelinkingHandle(IGoHandle handle) {
  GoHandle goh = handle.GoObject as GoHandle;
  if (goh != null) {
    goh.Style = GoHandleStyle.Diamond;
    RectangleF bounds = goh.Bounds;
    bounds.Inflate(bounds.Width/6, bounds.Height/6);
    goh.Bounds = bounds;
    goh.CursorName = "hand";
  }
}

public override void RemoveSelectionHandles(GoSelection sel) {
  if (this.HighlightWhenSelected) {
    bool oldskips = this.SkipsUndoManager;
    this.SkipsUndoManager = true;
    this.Highlight = false;
    this.SkipsUndoManager = oldskips;
  }
  sel.RemoveHandles(this);
}

}[/code]