Hi!
I create nodes programmatically in my constructor. The horizontal scrollbar is not displayed and I can't pan. It's like the size of the graphic is not correct. If I resize the window and move the last node, it works fine afterwards... Do you know what is wrong with my code?
Here is the code in the constructor:
int nodeCount = 20;
int xShift = 200;
int yShift = 100;
int xMax = 1000;
float width = 100;
int height = 75;
float xPos = 0;
float yPos = 0;
for (int i = 0; i < nodeCount; i++)
{
TableNode node = new TableNode(this.diagram1);
this.diagram1.Items.Add(node);
int number = i + 1;
node.Caption = "Node " + number;
node.Bounds = new RectangleF(xPos, yPos, width, height);
xPos += xShift;
if (xPos >= xMax)
{
xPos = 0;
yPos += yShift;
}
}
Designer code:
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.diagramView1 = new MindFusion.Diagramming.WinForms.DiagramView();
this.diagram1 = new MindFusion.Diagramming.Diagram();
this.SuspendLayout();
//
// diagramView1
//
this.diagramView1.Behavior = MindFusion.Diagramming.Behavior.LinkShapes;
this.diagramView1.ControlHandlesStyle = MindFusion.Diagramming.HandlesStyle.HatchHandles;
this.diagramView1.ControlMouseAction = MindFusion.Diagramming.ControlMouseAction.SelectNode;
this.diagramView1.DelKeyAction = MindFusion.Diagramming.DelKeyAction.DeleteSelectedItems;
this.diagramView1.Diagram = this.diagram1;
this.diagramView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.diagramView1.Location = new System.Drawing.Point(0, 0);
this.diagramView1.MiddleButtonActions = MindFusion.Diagramming.MouseButtonActions.Pan;
this.diagramView1.ModificationStart = MindFusion.Diagramming.ModificationStart.SelectedOnly;
this.diagramView1.Name = "diagramView1";
this.diagramView1.RightButtonActions = MindFusion.Diagramming.MouseButtonActions.Cancel;
this.diagramView1.Size = new System.Drawing.Size(292, 266);
this.diagramView1.TabIndex = 0;
this.diagramView1.Text = "diagramView1";
//
// diagram1
//
this.diagram1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
this.diagram1.GridSizeX = 25F;
this.diagram1.GridSizeY = 25F;
this.diagram1.MeasureUnit = System.Drawing.GraphicsUnit.Pixel;
this.diagram1.RoutingOptions.GridSize = 16F;
this.diagram1.RoutingOptions.NodeVicinitySize = 48F;
this.diagram1.TableCaptionHeight = 25F;
this.diagram1.TableColumnWidth = 80F;
this.diagram1.TableRowHeight = 24F;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.diagramView1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
private MindFusion.Diagramming.WinForms.DiagramView
All this code comes from a little sample program I did to narrow down the problem... There isn't any more code except for auto-generated one. It's just a window with a diagram view in it.
Thanks!
Marie
Note: the same problem occurs after loading a saved graph.