We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Diagram position

Thread ID:

Created:

Updated:

Platform:

Replies:

76347 Sep 2,2008 04:06 PM Nov 6,2008 12:47 AM Windows Forms 6
loading
Tags: Diagram
Sash
Asked On September 2, 2008 04:06 PM

I'm using the DirectedTreeLayoutManager and my rootnode always show up at the top left corner of the view. How do i center the root node.


J.Nagarajan [Syncfusion]
Replied On September 4, 2008 07:56 AM

Hi

Thanks for your interest in Syncfusion products.

You have to handle PreferredLayout event of the DirectedTreeLayoutManager and use the location property of that eventargs. Please refer to the below code snippet.

DirectedTreeLayoutManager dtlm = new DirectedTreeLayoutManager( this.diagram1.Model, 0, 20, 20 );
this.diagram1.LayoutManager = dtlm;
dtlm.PreferredLayout += new PreferredLayoutEventHandler(dtlm_PreferredLayout);
this.diagram1.LayoutManager.UpdateLayout( null );

void dtlm_PreferredLayout(object sender, PreferredLayoutEventArgs evtArgs)
{
evtArgs.Location = new PointF(150, 120);
}

Please let me if this helps.

Thanks,
Nagaraj



Sash
Replied On September 8, 2008 03:02 PM

Thanks this helps. I would like to know if there is a similar event for new child nodes created programatically. Ideally i would like new nodes to be somewhere close to its parent node..but they get added at position (0,0).



>Hi

Thanks for your interest in Syncfusion products.

You have to handle PreferredLayout event of the DirectedTreeLayoutManager and use the location property of that eventargs. Please refer to the below code snippet.

DirectedTreeLayoutManager dtlm = new DirectedTreeLayoutManager( this.diagram1.Model, 0, 20, 20 );
this.diagram1.LayoutManager = dtlm;
dtlm.PreferredLayout += new PreferredLayoutEventHandler(dtlm_PreferredLayout);
this.diagram1.LayoutManager.UpdateLayout( null );

void dtlm_PreferredLayout(object sender, PreferredLayoutEventArgs evtArgs)
{
evtArgs.Location = new PointF(150, 120);
}

Please let me if this helps.

Thanks,
Nagaraj





J.Nagarajan [Syncfusion]
Replied On September 10, 2008 01:51 AM

Hi Sash ,

Model.EventSink.NodeCollectionChanging event gets fired when a new node is created in the diagram model. If you want to layout that new child node, then please set AutoLayout property of the LayoutManager to true.

//NodeCollectionChanging event
this.diagram1.Model.EventSink.NodeCollectionChanging += new CollectionExEventHandler(EventSink_NodeCollectionChanging);
void EventSink_NodeCollectionChanging(CollectionExEventArgs evtArgs)
{

}

// To layout that new child node
DirectedTreeLayoutManager dtlm = new DirectedTreeLayoutManager( this.diagram1.Model, 0, 20, 20 );
this.diagram1.LayoutManager = dtlm;
dtlm.AutoLayout = true;
this.diagram1.LayoutManager.UpdateLayout( null );

Please let me know if this helps.

Thanks,
Nagaraj


Sash
Replied On October 14, 2008 07:25 PM

If my diagram has only one node...PreferredLayoutEventHandler has no effect. How do i place my first node in an appropriate position.

>Hi

Thanks for your interest in Syncfusion products.

You have to handle PreferredLayout event of the DirectedTreeLayoutManager and use the location property of that eventargs. Please refer to the below code snippet.

DirectedTreeLayoutManager dtlm = new DirectedTreeLayoutManager( this.diagram1.Model, 0, 20, 20 );
this.diagram1.LayoutManager = dtlm;
dtlm.PreferredLayout += new PreferredLayoutEventHandler(dtlm_PreferredLayout);
this.diagram1.LayoutManager.UpdateLayout( null );

void dtlm_PreferredLayout(object sender, PreferredLayoutEventArgs evtArgs)
{
evtArgs.Location = new PointF(150, 120);
}

Please let me if this helps.

Thanks,
Nagaraj





Administrator [Syncfusion]
Replied On November 6, 2008 12:44 AM

Hi

Thanks for your interest in Syncfusion products.

The PreferredLayoutEventHandler position the nodes only when we have connection between nodes. if diagram has only one node they don't postion the appropriate location.

If you need to place a first node in appropriate location, Please refer to the below code snippet.

RoundRect rect = new RoundRect(150,100, 50, 50, MeasureUnits.Pixel);
this.diagram1.Model.AppendChild(rect);

DirectedTreeLayoutManager dtlm = new DirectedTreeLayoutManager( this.diagram1.Model, 0, 20, 20 );
this.diagram1.LayoutManager = dtlm;
this.diagram1.LayoutManager.UpdateLayout( null );

Please let me know if this helps.

Thanks,
Ramesh M


Administrator [Syncfusion]
Replied On November 6, 2008 12:47 AM

Hi

Thanks for your interest in Syncfusion products.

Remove the below line you will get the first node position in approptiate location.

//this.diagram1.LayoutManager.UpdateLayout( null );

Please let me know if this helps.

Thanks,
Ramesh M



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;