Ejemplo n.º 1
0
 // закидываем создаем новый фрейм и отображаем
 private void добавитьФреймшаблонToolStripMenuItem_Click(object sender, EventArgs e)
 {
     AddFrameFrm frm = new AddFrameFrm();
     if (frm.ShowDialog()== DialogResult.OK)
     {
         Random rand = new Random();
         Frame frame = new Frame { FrameId = ClassFactory.kBase.GetMaxNodeId(1), FrameName = frm.TextBox };
         //frame.FrameSlots.Add(new Slot { SlotName = "slot" + ClassFactory.kBase.GetMaxSlotId(1), SlotId = 0, SlotInheritance = SlotInherit.Override, SlotType = Classes.SlotType.Integer });
         //frame.FrameSlots.Add(new Slot { SlotName = "slo1t" + ClassFactory.kBase.GetMaxSlotId(1), SlotId = 1, SlotInheritance = SlotInherit.Same, SlotType = Classes.SlotType.Frame });
         ShapeNode node = new ShapeNode { Text = frame.FrameName, Id = frame.FrameId, Brush = new SolidBrush(Color.PowderBlue), Shape = Shapes.Ellipse };
         node.SetBounds(new RectangleF(new PointF(rand.Next(100, 400), rand.Next(100, 400)), new SizeF(100, 30)), true, true);
         node.Font = new System.Drawing.Font("Microsoft Sans Serif", 9, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
         node.TextFormat.Alignment = StringAlignment.Center;
         node.TextFormat.LineAlignment = StringAlignment.Center;
         ClassFactory.isSaved = false;
         frame.X = node.GetBounds().X;
         frame.Y = node.GetBounds().Y;
         FrameDiagram.Nodes.Add(node);
         ClassFactory.kBase.AddFrame(frame);
         TreeNode frameitem = new TreeNode { Text = frame.FrameName };
         FrameTreeView.Nodes.Add(frameitem);
     }
 }
Ejemplo n.º 2
0
 private void FraimDiagram_NodeCreated(object sender, MindFusion.Diagramming.NodeEventArgs e)
 {
     ShapeNode node = e.Node as ShapeNode;
     if (node != null)
     {
         AddFrameFrm frm = new AddFrameFrm();
         if (frm.ShowDialog()== DialogResult.OK)
         {
             Frame frame = new Frame { FrameId = ClassFactory.kBase.GetMaxNodeId(), FrameName = frm.TextBox };
             node.Id = frame.FrameId;
             node.Text = frame.FrameName;
             ClassFactory.kBase.AddFrame(frame);
             TreeNode frameitem = new TreeNode { Text = frame.FrameName };
             FrameTreeView.Nodes.Add(frameitem);
         }
     }
 }