Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Freehand Draw / Sketching functionality? (Read 3108 times)
danielt
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Nov 21st, 2013
Freehand Draw / Sketching functionality?
Nov 21st, 2013 at 12:16pm
Print Post  
Hello,

I am currently evaluating the MindFusion controls and wondered whether there is any way I could implement some kind of freehand drawing functionality, either with built in functions / controls, or by modifying current controls.

I am just asking to gauge how difficult this task could be, if it is possible at all.

Thanks in advance.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Freehand Draw / Sketching functionality?
Reply #1 - Nov 21st, 2013 at 12:37pm
Print Post  
Hi,

You will have to use a custom item class, you can find an example here:
http://mindfusion.eu/Forum/YaBB.pl?num=1320391922/7#7

The code above is for WPF, you will have to replace Point with PointF and use respective Graphics methods when drawing instead of DrawingContext ones.

You might want to derive from DiagramLink instead of DiagramNode and add to link's ControlPoints collection if you need to let users edit individual points later - links provide that out of the box.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
danielt
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Nov 21st, 2013
Re: Freehand Draw / Sketching functionality?
Reply #2 - Nov 21st, 2013 at 3:18pm
Print Post  
We have attempted this type of thing before and had issues, is there any chance you have a clear Windows Forms example of how we could implement this?

At the moment this seems to be the only issue we are having.

Thanks in advance.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Freehand Draw / Sketching functionality?
Reply #3 - Nov 21st, 2013 at 6:53pm
Print Post  
You can find a Windows Forms example here:
https://mindfusion.eu/_samples/FreehandDraw.zip

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
danielt
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Nov 21st, 2013
Re: Freehand Draw / Sketching functionality?
Reply #4 - Nov 22nd, 2013 at 10:56am
Print Post  
That is absolutely fantastic. Thank you so much for your help. I have one more question, I suppose to be able to create poly lines, I would only have to remove code from the example you have just posted, in order to make it work?

Many thanks again.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Freehand Draw / Sketching functionality?
Reply #5 - Nov 22nd, 2013 at 12:53pm
Print Post  
The example already draws polylines. If you need to straighten them up to show longer line segments, you could add some code that tracks the mouse movement direction, and add new points only when you detect a large enough change in direction.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint