Arrow link marker in balloon comment

The GoBalloon object has a wedge that points to an object. Our customers prefer to use an arrow as a pointer to a node instead of the wedge from default. What is the best way to implement this? Which properties and methods are required to be overridden and how? Please give me a sample code.

Product: Win 2.6.2 for .NET 2.0 Platform: XP with SP2

Thanks advance,


Can you update the email in your profile with a corporate address that we can match to an order?

I have updated my email in my profile with our corporate address.


[code] // Each ArrowBalloon has an extra child object, a GoStroke,
// that is the arrow going from the balloon to the Anchor.
public class ArrowBalloon : GoBalloon {
public ArrowBalloon() {
myStroke = new GoStroke();
myStroke.AddPoint(0, 0); // make sure there are two points:
myStroke.AddPoint(0, 0); // they will get set by LayoutChildren
myStroke.ToArrow = true;
Insert(0, myStroke); // the stroke is behind the Background in Z-order
this.Label.EditableWhenSelected = true;

// update the "myStroke" field for the copied ArrowBalloon
protected override void CopyChildren(GoGroup newgroup, GoCopyDictionary env) {
  base.CopyChildren(newgroup, env);
  ArrowBalloon newballoon = (ArrowBalloon)newgroup;
  newballoon.myStroke = (GoStroke)env[myStroke];

// simpler background shape than for regular GoBalloon
protected override GoObject CreateBackground() {
  GoRoundedRectangle r = new GoRoundedRectangle();
  r.Selectable = false;
  r.BrushColor = Color.LemonChiffon;
  r.PenColor = Color.LightGray;
  r.Shadowed = true;
  return r;

// simpler implementation than GoBalloon's 
public override void LayoutChildren(GoObject childchanged) {
  if (this.Initializing) return;
  GoText label = this.Label;
  if (label == null) return;
  GoRectangle back = this.Background as GoRectangle;
  if (back != null && childchanged != back) {
    back.Bounds = ComputeBounds();
  if (myStroke != null) {
    PointF anchorpt = ComputeAnchorPoint();
    myStroke.SetPoint(0, this.Label.Center);
    myStroke.SetPoint(1, anchorpt);

// can't use the standard GoBalloon implementation
public override RectangleF ExpandPaintBounds(RectangleF rect, GoView view) {
  rect = RectangleF.Union(rect, myStroke.Bounds);
  GoObject back = this.Background;
  if (back != null) {
    rect = RectangleF.Union(rect, back.Bounds);
    rect = back.ExpandPaintBounds(rect, view);
  return rect;

// access to the "arrow", so you can set its properties
// (the TypeConverter attribute is for easy access in a PropertyGrid)
public GoStroke Arrow {
  get { return myStroke; }

private GoStroke myStroke;


How to replace ToArrow with small Image ?


It is what I want exactly! Tongue

Thank you very much.

re: replace ToArrow

see the FAQ entry "How do I draw my own arrowheads?".


I have played with your code. I can change the background color, text color, border color, and arrow color.

Then, get 2 more questions:

  1. If the background is set to “Transparent”, the arrow line inside the balloon border is visible, since the starting point of the arrow line is in the center of the balloon. How could the starting point be at the border of the balloon node?

  2. Since the arrow line is a GoStroke object, it is better to allow inserting points via a context menu. I tried, but could not make the arrow line selectable even though the selectable property is set to true.

  1. You’ll need to change LayoutChildren to set point 0 to the right value, which you can calculate by calling GoObject.GetNearestIntersectionPoint.

  2. Yes, GoBalloon artificially changes the Bounds to just be the Label’s Bounds plus margins. Since the GoStroke is outside of the Bounds, it is not pickable.

I have another question about this topic.

When the arrow is dragged to the anchored object, the line and arrow did redraw until the mouse is released. How could I do to make the arrow line redrawing as the mouse moved? I mean the same behavior as the GoBalloon.

Thank you advance.