Does GoXam support free form curves to be drawn or just lines?
Not “out-of-the-box”, but it shouldn’t be hard to implement a DiagramTool that does that. I’ll try it soon.
Just to be clear, you’re talking about a tool that lets the user draw an arbitrary curve following the mouse just as one might in Paint, except producing a vector line drawing as an object?
Is there an example of that that could be shared with?
Hello Walter ! Can you give me exmaple too ?
OK, maybe it’s time to create a drawing app. I’ll start on it right after I have finished getting the 1.2 beta kits ready.
I have created a “SilverlightDraw” app that supports freehand drawing of lines. This is implemented by FreehandDrawingTool.
But of course the next thing one would want is to be able to interactively adjust the points of the resulting Polyline. So I implemented a PolylineReshapingTool.
Then I figured someone would ask about how to draw a Polyline using multiple clicks, rather than just following the mouse while the left mouse button was down. So I implemented a PolylineDrawingTool.
You stop the PolylineDrawingTool by typing Enter or (in Silverlight 4) by right-mouse-clicking. You can also remove the last clicked point by typing Z. You can cancel the whole drawing process by typing Escape.
These are all in the SilverlightDraw example app:
One caution: I discovered a bug in selection adornments in GoSilverlight when the adorned element is a Polyline. This will be fixed for the 1.2 release. For now, it just means that you can’t say go:Part.SelectionAdorned=“True”. But it’s not a bug in GoWPF.
It was pretty easy to implement. The only complexity came from needing to normalize all of the Points in the Polyline so that they have minimum X and Y values of zero. That way the Node.Position could be assigned properly given the set of Points.
Another subtlety is that the temporary Node used to hold the Polyline that is being drawn is put into the “Tool” layer. That makes sure it is in front of everything else and also avoids some side-effects, such as being recorded by the UndoManager.
Thank you very much
Walter for the fine example and answer.