Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Drawing Tools (Read 1812 times)
Ivan K.
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Jun 30th, 2021
Drawing Tools
Jun 30th, 2021 at 2:20pm
Print Post  
Hi! I'm new to MindFusion diagramming toolset, but it looks very promising for the project we are going to start. I played around and it was easy to create a simple WPF application where shapes can be linked.

One of the features the application will have is simple drawing tools. We will need to render a diagram and allow a user to create some basic primitives (lines, rectangles, text, arcs, etc) on it. See the example attached.

It would be nice having an AutoCAD-like feature to prepare a set of drawings. How easy it would be to "extend" the component and embed drawing tools like at draw.io? I see there are basic shapes but I didn't find for example how to draw a simple line or arc.

Another question. Is it possible to use the Skia library to render a diagram?

Thanks! Smiley
  

ControlDrawings2.jpg ( 430 KB | 109 Downloads )
ControlDrawings2.jpg
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Drawing Tools
Reply #1 - Jun 30th, 2021 at 2:49pm
Print Post  
Hi!

Quote:
We will need to render a diagram and allow a user to create some basic primitives (lines, rectangles, text, arcs, etc) on it.


For lines you could use unconnected DiagramLink objects. E.g. set Diagram.AllowUnconnectedLinks = true and Diagram.Behavior = DrawLinks, then drawing with the mouse should create a standalone line-like DiagramLink. You might need to customize it to hide arrowheads.

For arc-like objects, check if unconnected links whose Shape is set to Spline or Bezier will work for you.

You could use ShapeNodes with Shape set to Rectangle to draw rectangles. Possibly set their Brush to Transparent if you don't need them filled.

You could show text using ShapeNodes whose Transparent property is enabled to hide the geometry and render only the Text property value.

If you prefer dedicated object types for these, you could derive from DiagramNode and implement rendering and interactions by overriding methods such as Draw, UpdateCreate, UpdateModify.

Quote:
How easy it would be to "extend" the component and embed drawing tools like at draw.io?


You could create custom node types using Xaml templates as shown in tutorials 3&4, or by overriding Draw method as shown in e.g. IconNodes sample project.

You could show custom types in a NodeListView instance to create tool palettes as in draw.io. To enable drag-and-drop, you'd also have to implement serialization and cloning methods.

Quote:
Another question. Is it possible to use the Skia library to render a diagram?


There's no built-in support for Skia. Maybe you could export the diagram to SVG using SvgExporter, and draw the SVG drawing in your Skia target using libraries such as https://github.com/wieslawsoltes/Svg.Skia

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint