Diagram comes up as a square

I want to add a diagram to my user interface, but no matter how I resize it (dock in parent container, undock and draw it in the [Design] window, size it at runtime) it always comes up as a square.
Here is a snip of three that I have tried, using different settings.

How can I get it to size to its parent container?

Thank you.


3 Replies

GG Gowtham Gunashekar Syncfusion Team March 17, 2021 01:17 PM UTC

Hi Joanne, 
 
We have added a code snippet to demonstrate how to set the size of the diagram drawing pad. 
 
Code snippet: 
 
Diagram.Model.LogicalSize = new SizeF(1000, 500); 
 
 
Also, you can use controls Dock property to positioning the diagram in the form. 
 
 
Code snippet: 
Diagram.Dock = DockStyle.Fill; 
 
 
Regards, 
Gowtham 



JL Joanne Ling March 17, 2021 06:44 PM UTC

Hi

Thank you for that.  Unfortunately it still doesn't work - I still get a square shaped diagram.

I had already tried to set the dock type to "Fill" and that didn't work either.

Is there something in the initial setup of the diagram?  Here is the generated code in Form1.Designer.cs:

            this.diagram1.BackColor = System.Drawing.Color.DarkGray;
            binding1.DefaultConnector = null;
            binding1.DefaultNode = null;
            binding1.Diagram = this.diagram1;
            binding1.Id = null;
            binding1.Label = ((System.Collections.Generic.List<string>)(resources.GetObject("binding1.Label")));
            binding1.ParentId = null;
            this.diagram1.Binding = binding1;
            this.diagram1.Controller.Constraint = Syncfusion.Windows.Forms.Diagram.Constraints.PageEditable;
            this.diagram1.Controller.DefaultConnectorTool = Syncfusion.Windows.Forms.Diagram.ConnectorTool.OrgLineConnectorTool;
            this.diagram1.Controller.PasteOffset = new System.Drawing.SizeF(10F, 10F);
            this.diagram1.EnableTouchMode = false;
            this.diagram1.LayoutManager = null;
            this.diagram1.Location = new System.Drawing.Point(39, 50);
            this.diagram1.Model = this.model1;
            this.diagram1.Name = "diagram1";
            this.diagram1.ScrollVirtualBounds = ((System.Drawing.RectangleF)(resources.GetObject("diagram1.ScrollVirtualBounds")));
            this.diagram1.ShowRulers = true;
            this.diagram1.Size = new System.Drawing.Size(539, 279);
            this.diagram1.SmartSizeBox = false;
            this.diagram1.TabIndex = 1;
            this.diagram1.Text = "diagram1";


Best Regards

Jo



GG Gowtham Gunashekar Syncfusion Team March 18, 2021 01:51 PM UTC

Hi Joanne, 
 
We request you to share us machine configuration and display settings, that will help us to serve you better, 
 
Regards, 
Gowtham 
 


Loader.
Up arrow icon