I have a few resizable orthogonal GoLabeled links in my application. As such it displays 6 resize handles. I would like to control which the resize handles the user can use to resize the link,
For e.g., When the user positions the mouse over a resize handle then a mouse cursor with vertical/horizontal direction would appear allowing the user to resize the link via that resize handle, however when the user positions the mouse over some other resize handle the user should not be allowed to resize the link (thereby anchoring those points).
Is this possible? Can I make some resize handles have the “resizable” behavior and the other resize handles with the display and behavior such as that when the link’s resizable property is set to false.
The resizing behavior of resize handles is controlled by the GoHandle.HandleID in cooperation with GoLink.DoResize; the mouse cursor is controlled by GoHandle.GetCursorName and can be set by setting GoHandle.CursorName.
GoLink.AddSelectionHandles is what actually calls GoSelection.CreateResizeHandle. You could override GoLink.AddSelectionHandles to modify any GoHandles created by calling the base method, or you could just reimplement AddSelectionHandles to do exactly what you want.
The HandleID for most handles is just the index of the corresponding stroke point + GoObject.LastHandle. Ones that do not support resizing have a handle ID of GoObject.NoHandle. However handles at and near the end have special IDs.
Normally, moving the end handles doesn’t just move the corresponding point in the stroke but instead causes the link to be relinked. Their IDs are GoLink.RelinkableFromHandle and GoLink.RelinkableToHandle. Of course this is disabled if GoLink.Relinkable is false by using GoObject.NoHandle instead.
The handles next to the end ones (i.e. the second and the next-to-last one) are naturally constrained to move in just one direction. They have special IDs too (some of the standard spot handles). Those IDs are treated specially by the implementation of DoResize. Otherwise if the handle ID is >= GoObject.LastHandle, DoResize just modifies the corresponding point in the stroke to follow the position of the mouse while reshaping. Of course DoResize also tries to maintain orthogonality of the link, if needed, so DoResize may also modify adjacent points in the link.
I think the implementation problem that you face is that the standard behavior of DoResize assumes that only the next-to-the-end handles might be constrained to move in only one orientation. So setting the HandleID of some internal GoHandle will make that handle non-movable, OK, but the adjacent handles will be movable in inadmissable ways, because the user could move them to break orthogonality.
If I were you I would be tempted to reimplement entirely both GoLink.AddSelectionHandles and GoLink.DoResize, so that you can make sure it does exactly what you want. You needn’t follow the same HandleID numbering convention. Send me e-mail and I can send you the source code for both of those methods, so you have something to copy from.