Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Manually create Database diagram with relationship (Read 5813 times)
bruser
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Feb 10th, 2015
Manually create Database diagram with relationship
Feb 10th, 2015 at 4:06am
Print Post  
Hello guys, I have this problem while using these code to manually create a relationship between 2 entities. The code is:
Code
Select All
var link = new DiagramLink(diagram);
link.Origin = e1;
link.Destination = e2;

link.OriginAnchor = 0;
link.DestinationAnchor = 1;
diagram.Links.Add(link);  



The Destination point of the relationship is correct but the Original point is always stuck at the top left of Window form, as in this photo Cheesy Please help.
  

mindfusion_relationship_issue.jpg ( 86 KB | 100 Downloads )
mindfusion_relationship_issue.jpg
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Manually create Database diagram with relationship
Reply #1 - Feb 10th, 2015 at 9:16am
Print Post  
Hi,

The link.*Anchor properties will do nothing if you haven't set nodes' AnchorPattern. If you need to specify which rows should get connected, set the OriginIndex and DesintationIndex properties instead, or pass them as arguments to CreateDiagramLink method:

Code
Select All
var link = new DiagramLink(diagram);
link.Origin = e1;
link.Destination = e2;

link.OriginIndex = 0;
link.DestinationIndex = 0;
diagram.Links.Add(link);

//diagram.Factory.CreateDiagramLink(e1, 0, e2, 0); 



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


I Love MindFusion!

Posts: 5
Joined: Feb 10th, 2015
Re: Manually create Database diagram with relationship
Reply #2 - Feb 11th, 2015 at 12:55am
Print Post  
It helps, thank you very much  Wink, one more question if I can ask here. How can I define the distance between 2 entities?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Manually create Database diagram with relationship
Reply #3 - Feb 11th, 2015 at 9:14am
Print Post  
If you need to arrange the tables automatically, try setting NodeDistance / LayerDistance properties in some of the layout classes:

Code
Select All
var layout = new LayeredLayout();
layout.Orientation =
	MindFusion.Diagramming.Layout.Orientation.Horizontal;
layout.LayerDistance = 40;
layout.Arrange(diagram); 



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


I Love MindFusion!

Posts: 5
Joined: Feb 10th, 2015
Re: Manually create Database diagram with relationship
Reply #4 - Feb 12th, 2015 at 1:26am
Print Post  
Thank you for your reply, could you also tell me how to change color for the diagramLink arrows? Also is there anyway to disable delete control via keyboard delete button for the diagramLink?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Manually create Database diagram with relationship
Reply #5 - Feb 12th, 2015 at 8:01am
Print Post  
You can change link's colors by setting its Pen, HeadPen and Brush properties. Set DiagramView.DelKeyAction = None to disable deleting items altogether, or handle LinkDeleting validation event to prevent deleting links only.

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


I Love MindFusion!

Posts: 5
Joined: Feb 10th, 2015
Re: Manually create Database diagram with relationship
Reply #6 - Feb 16th, 2015 at 11:54pm
Print Post  
Now I have another problem, the this.diagram.Print() won't work, it said does not contain a definition for 'Print'. Am I missing something?  Embarrassed
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Manually create Database diagram with relationship
Reply #7 - Feb 17th, 2015 at 8:00am
Print Post  
Call DiagramView.Print() instead of Diagram.Print().

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


I Love MindFusion!

Posts: 5
Joined: Feb 10th, 2015
Re: Manually create Database diagram with relationship
Reply #8 - Feb 18th, 2015 at 1:47am
Print Post  
It's a little blurring but least it worked, if you have any advice to improve the quality please tell me. Thank you for your support so far  Smiley
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Manually create Database diagram with relationship
Reply #9 - Feb 18th, 2015 at 11:05am
Print Post  
What's blurry exactly - graphics on printed page? If printing in gray-scale you will get some patterns printed instead of colors and gradients, which will make text harder to read, so you could try disabling brushes to get only text and frame lines:

Code
Select All
diagramView.PrintOptions.EnableInterior = false;
diagramView.PrintOptions.EnableShadows = false; 



You might also try changing anti-aliasing options temporarily before printing:

Code
Select All
diagramView.SmoothingMode = SmoothingMode.None;
diagramView.TextRenderingHint = TextRenderingHint....; 



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