I try to change the mouse cursor from “arrow” to “no” if two ports can not be linked together.
I have already taken the “IsValidLink” function to find out if the ports can be linked together and this works fine.
But where can I changed the mouse cursor?
You’ll need to customize the behavior of the linking tools to set the cursor the way you want at the times you want.
There are some example tools that set the cursor, but they just do so in Start and in Stop, for the lifetime of the tool. You’ll want to override some method in GoToolLinkingNew and in GoToolRelinking. But it isn’t clear to me what you want to do, particularly in the common case where there might not be a valid link at the current mouse point, but there is to a different port within the port gravity distance.
thanks a lot.
To override GoToolLinkingNew and GoToolRelinking is exactly what I have to do.
I have done this:
In MyView class constructor I have replaced the tools with:
ReplaceMouseTool(typeof(GoToolLinkingNew), new MyToolLinkingNew(this));
ReplaceMouseTool(typeof(GoToolRelinking), new MyToolRelinking(this));
and in this classes (MyToolLinkingNew and MyToolRelinking) I have overriden the DoMouseMove method.