CreateBoundingHandle Problem

Hello,

I have a problem that I can relate back to CreateBoundingHandle.

First, I am creating a rounded rectangle handle around my objects, as suggested in an earlier post from Walter:

While Walter’s suggstion works great and does exactly what I want it to do, for any object that’s selected the object’s tooltip method won’t fire. Not only that but the object’s ports are no longer accessible either. If I unselect the object (by selecting some other object or just clicking in the GoView’s background) the handle goes away and then the object’s tooltip method works and the object’s ports are accessible.

What I don’t understand is when I just call the base method mybase.CreateBoundingHandle, I get a rectangular handle around my object that does not obscure either tooltips or ports. What can I do to my override of CreateBoundingHandle to allow tootips and ports to work as I would expect, just like the base method.

Thanks.

R. Houston

Demo1’s MultiTextNodeWithBack has the same rounded rect selection handle… and has the same problem you’re seeing… let me go ponder this a while.

try this:
[Serializable]
public class RoundedHandle : GoHandle {

public override void Paint(Graphics g, GoView view) {
RectangleF r = this.Bounds;
DrawRoundedRectangle(g, view, this.Pen, this.Brush, r.X, r.Y, r.Width, r.Height, 10, 10);
}
}

Hi Jake,

Success! What you suggested works, with a couple of modifications that suit my situation:

  1. To the RoundedHandle class I added a member variable, mCorner, a sizef, to persist the handle corner’s width and height.

  2. To the RoundedHandle class I added a Corner property to get/set mCorner. I modified the paint
    method’s CreateRoundedRectangle to use mCorner accordingly:
    DrawRoundedRectangle(g, view, this.Pen, this.Brush, r.X, r.Y,
    r.Width, r.Height, mCorner.width, mCorner.height);

  3. In the class creating the handle I, one, set the handle’s corner, and two, set the handle’s bounds, per Walter’s suggestions (link to Walter’s suggestions in my first post, above).

Well, I guess that’s it. Thanks a lot for your help, Jake. Lastly, any thoughts on why a GoHandle will work as expected but a GoRoundedRectangle with all the proper overrides will not?

Thanks again.

R. Houston

No, I don’t understand why Walter’s solution doesn’t work. I need to chat with Walter about that.

GoHandle overrides ContainsPoint to treat the shape as if it were a hollow rectangle.