Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Make diagram size dynamic / changed when shape exceeds diagram bounds (Read 2222 times)
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Make diagram size dynamic / changed when shape exceeds diagram bounds
Oct 26th, 2012 at 10:25pm
Print Post  
Is there a way to make the diagram size dynamic so that if a shape creeps out of bounds, the diagram height or width gets increased? AND, ideally decreased when its well within bounds?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Make diagram size dynamic / changed when shape exceeds diagram bounds
Reply #1 - Oct 27th, 2012 at 8:10am
Print Post  
Set the Diagram.AutoResize property. I think you disabled it a few posts back because you wanted the diagram to stay as large as your lane nodes back then Smiley

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
saad
Full Member
***
Offline


I Love MindFusion!

Posts: 117
Joined: Oct 8th, 2012
Re: Make diagram size dynamic / changed when shape exceeds diagram bounds
Reply #2 - Oct 27th, 2012 at 8:38am
Print Post  
I'll consider this solved.

I wanted only height to increase (as the lanes were added).

In protected void diagramView_NodeModified(object sender, NodeEventArgs e)

Code
Select All
 //----------
        // adjust DIAGRAM HEIGHT as lanes are added / dropped to compact the diagram around lanes

        // refering diagram
        //Diagram diagramPB = diagramView.Diagram;

        // finding last stage
        ShapeNode lastShapeNode = diagramPB.FindNodeById("Stage " + extVarStages) as ShapeNode;

        // check if last shape node's bottom is greater than diagram height,
        // if so increase diagram height to last shape node's bottom
        if (lastShapeNode.Bounds.Bottom > diagramHeight)
        {

            diagramHeight = Convert.ToInt32(lastShapeNode.Bounds.Bottom);
            diagramPB.Bounds = new System.Drawing.RectangleF(0, 0, diagramWidth, diagramHeight);
        }

        // check if last shape node's bottom is lesser than diagram height,
        // if so decrease diagram height to last shape node's bottom
        if (lastShapeNode.Bounds.Bottom < diagramHeight)
        {

            diagramHeight = Convert.ToInt32(lastShapeNode.Bounds.Bottom);
            diagramPB.Bounds = new System.Drawing.RectangleF(0, 0, diagramWidth, diagramHeight);
        }

        //------------ 



Might come to some use for someone so i thought i'd paste it.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint