Page Index Toggle Pages: 1 2 [3]  Send TopicPrint
Very Hot Topic (More than 25 Replies) Any VB.net sample? (Read 32954 times)
ysliew
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 21
Joined: Jul 18th, 2007
Re: Any VB.net sample?
Reply #30 - Aug 1st, 2007 at 1:55am
Print Post  
Stoyo wrote on Jul 31st, 2007 at 1:02pm:
Please email me the diagram, saved in XML format after arranging the tree and resizing the document.


Quote:
private void Write(string fileName)
{

                 MindFusion.Diagramming.Xml.XmlWriter writer =

                       new MindFusion.Diagramming.Xml.XmlWriter(_flowChart);



                 writer.SerializeTag += new MindFusion.Diagramming.Xml.SerializeTagEvent(

                       this.SerializeTag);

                 writer.Options.WriteImages = true;

                 writer.Write(fileName);

}


I couldn't find the reference for MindFusion.Diagramming.Xml, please advise.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Any VB.net sample?
Reply #31 - Aug 1st, 2007 at 6:31am
Print Post  
Try using the MindFusion.Diagramming.WebForms.Xml namespace.
  
Back to top
 
IP Logged
 
ysliew
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 21
Joined: Jul 18th, 2007
Re: Any VB.net sample?
Reply #32 - Aug 1st, 2007 at 8:26am
Print Post  
Hi,

Quote:
For 3 & 4, handle the TreeExpanded and TreeCollapsed events and in the event handlers rearrange the diagram and set the document bounds.


What code should I put in these events?

I tried to put
tl.Arrange(FlowChart1)
FlowChart1.FitDocToObjects(0.5)
but the chart did not arranged well.

Quote:
There isn't any function that will move the whole chart. You could move with the same offset the BoundingRectangle values of all boxes and the control points of all arrows. 



I tried the following codes to move the root, and hit the error Object reference not found.

Dim rootNode As Node = tl.Root
rootNode.Move(600, 340) 

Quote:
Currently that's possible only in the Windows Forms and ActiveX versions of the control.

Stoyan


If I would like to put a photo and a button in the nodes, what kind of controls should I use? 3rd party controls?

Thanks.

P/S : I have sent the XML to your email.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Any VB.net sample?
Reply #33 - Aug 2nd, 2007 at 12:01pm
Print Post  
We have received MyOrg.xml, but can't see anything wrong with it after loading it in our test web site. What exactly you do not like there?

Quote:
I tried to put 
tl.Arrange(FlowChart1) 
FlowChart1.FitDocToObjects(0.5) 
but the chart did not arranged well. 


What's the complete initialization code for the TreeLayout object?

Stoyan
  
Back to top
 
IP Logged
 
ysliew
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 21
Joined: Jul 18th, 2007
Re: Any VB.net sample?
Reply #34 - Aug 2nd, 2007 at 11:17pm
Print Post  
Hi Stoyo,

Code
Select All
tl.ArrowStyle = Layout.TreeLayoutArrowType.Cascading3
tl.NodeDistance = 20
tl.LevelDistance = 50
tl.Arrange(FlowChart1)
FlowChart1.AntiAlias = Drawing2D.SmoothingMode.None
FlowChart1.ExpandButtonAction = ExpandButtonAction.ExpandTreeBranch
FlowChart1.ExpandButtonPosition = ExpandButtonPosition.OuterLowerLeft
FlowChart1.FitDocToObjects(0.5)
 



Above are my codes to initializate the TreeLayout object after getting the nodes and drawing the arrows.

(i) Now I'm having the problem that the chart is not rearrange after I clicked the Expand button.

(ii) After I called the FitDocToObjects function, I would like the the blank space covered by the backgroud instead of leaving a blank space.



(iii) I can't move the root node to the center of the page with below codes and hit error "Object reference not found."

Code
Select All
Dim rootNode As Node = tl.Root
rootNode.Move(600, 340)
 



(iv) I would like to add some controls into the boxes, kindly guide me on that.

P/S : If you need the full source code just let me know.

Thanks a lot.

Regards.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Any VB.net sample?
Reply #35 - Aug 3rd, 2007 at 5:47am
Print Post  
Hi,

(i) You must handle the TreeExpanded and TreeCollapsed server-side events and run the layout from there, e.g.

Code
Select All
protected void fc_TreeExpanded(object sender, MindFusion.Diagramming.WebForms.NodeEventArgs e)
{
	TreeLayout tl = new TreeLayout();
	tl.ArrowStyle = TreeLayoutArrowType.Cascading3;
	tl.NodeDistance = 20;
	tl.LevelDistance = 50;
	tl.Arrange(fc);

	fc.FitDocToObjects(5);
}

protected void fc_TreeCollapsed(object sender, MindFusion.Diagramming.WebForms.NodeEventArgs e)
{
	TreeLayout tl = new TreeLayout();
	tl.ArrowStyle = TreeLayoutArrowType.Cascading3;
	tl.NodeDistance = 20;
	tl.LevelDistance = 50;
	tl.Arrange(fc);

	fc.FitDocToObjects(5);
}
 

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Any VB.net sample?
Reply #36 - Aug 3rd, 2007 at 6:03am
Print Post  
(ii) Try setting some fixed Width and Height property values for the control. Otherwise it mght resize to become as big as DocExtents.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Any VB.net sample?
Reply #37 - Aug 3rd, 2007 at 6:05am
Print Post  
(iii) TreeLayout.Root is null/Nothing by default. In that case calling Arrange will automatically find what node to use as a root. However it won't set the found node as a value of TreeLayout.Root, so you cannot use TreeLayout.Root without setting it first yourself.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Any VB.net sample?
Reply #38 - Aug 3rd, 2007 at 6:07am
Print Post  
(iv) You can't use other controls and nodes in NetDiagram. If you just need to show a photo and a button, use the Box.Image property, and use additional attached boxes to mimic buttons.

Stoyan
  
Back to top
 
IP Logged
 
ysliew
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 21
Joined: Jul 18th, 2007
Re: Any VB.net sample?
Reply #39 - Aug 3rd, 2007 at 7:58am
Print Post  
Hi,

Thanks for your reply.

Stoyo wrote on Aug 3rd, 2007 at 6:03am:
(ii) Try setting some fixed Width and Height property values for the control. Otherwise it mght resize to become as big as DocExtents.


(i) Do you mean if I set both the width and height to 100%, calling the FixFitDocToObjects function will result the blank space?

(ii) Any function that I can get the total node count and node level count?

Thanks.

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Any VB.net sample?
Reply #40 - Aug 3rd, 2007 at 9:19am
Print Post  
Hi,

The Width and Height values you set are used as Width and Height of the generated DIV that contains the flowchart image. The DIV background color is set to the flowchart's BackColor. If the image is larger than the fixed-size DIV, there are scrollbars displayed. I am not much into HTML and don't know what is the effect of using % sizes, but from your screenshot it seems the DIV size is set to that of the enclosed image.

The total node count is FlowChart.Boxes.Count, in case you are using only Box nodes. You can find the number of levels by finding the largest distance from leaf nodes to the root. E.g. visit recursively IncomingArrows[0].Origin starting from each leaf node, counting how many levels you visit until the root.

Stoyan
  
Back to top
 
IP Logged
 
ysliew
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 21
Joined: Jul 18th, 2007
Re: Any VB.net sample?
Reply #41 - Aug 6th, 2007 at 8:03am
Print Post  
Thanks Stoyo.

I have no idea on how to get distance between 2 nodes, could you please provide a simple example?

Besides, I tried the following code to move the root node but it doesn't work.

Code
Select All
tl.Root.Move(600, 34)
 



Please advise, thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Any VB.net sample?
Reply #42 - Aug 6th, 2007 at 12:00pm
Print Post  
If you are calling root.Move() before TreeLayout.Arrange(), enable the TreeLayout.KeepRootPos property. Otherwise Arrange will move the whole tree to the top-left of the diagram.

By distance I meant the number of levels between nodes, which you can find by passing an integer counter to the recursive function and increasing it with each recursive call.

Stoyan
  
Back to top
 
IP Logged
 
ysliew
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 21
Joined: Jul 18th, 2007
Re: Any VB.net sample?
Reply #43 - Aug 7th, 2007 at 2:40am
Print Post  
Thanks Stoyo.

Need your advise on the Root.Move() again.

Code
Select All
tl.Root.Move(50, 400)
tl.KeepRootPosition = True
tl.NodeDistance = 20
tl.LevelDistance = 50
tl.Arrange(FlowChart1)
 



I have called KeeoRootPosition but it still doesn't move the node.

Also, how could I get the actuall width and height of the display area? As both will change depending on the no. of boxes and will be different from the fixed values that I set.

Thanks.



  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Any VB.net sample?
Reply #44 - Aug 7th, 2007 at 5:48am
Print Post  
Call the GetContentRect method after appling the layout to find out the width and height of the whole tree.

If you are calling FitDocToObjects after Arrange, you might not notice that the box has been moved.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 2 [3] 
Send TopicPrint