private void newToolStripButton_Click(object sender, EventArgs e)
        {
            FlowComponents.Clear();
            this.pnlMain.Controls.Clear();
            this.FlowConnectors.Clear();

            FlowStart fs = new FlowStart();

            StartNode = fs;
            this.SuspendLayout();
            this.pnlMain.Controls.Add(fs);
            fs.SetComponentContainer(this);
            fs.Left = (this.pnlMain.Width - fs.Width) / 2;
            fs.Top  = 50;
            FlowComponents.Add(fs);
            this.AddFlowComponent(fs);
            this.ResumeLayout();
        }
        public FlowDiagram()
        {
            InitializeComponent();
            sg.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
            bg.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
            sg.Width     = 1;
            bg.Width     = 1;
            //incarcam o diagrama de start
            FlowStart fs = new FlowStart();

            StartNode = fs;
            this.SuspendLayout();
            this.pnlMain.Controls.Add(fs);
            fs.SetComponentContainer(this);
            fs.Left = (this.pnlMain.Width - fs.Width) / 2;
            fs.Top  = 50;
            FlowComponents.Add(fs);
            this.AddFlowComponent(fs);
            this.ResumeLayout();
        }
        private object RebuildUI(FlowComponentXML fcx)
        {
            //throw new NotImplementedException();
            //FlowComponentXML current = fdx.FlowTree;
            //while (
            FlowComponent fc = null;

            if (fcx.type == 1)
            {
                fc             = new FlowStart();
                this.StartNode = fc;
            }
            else if (fcx.type == 2)
            {
                fc = new FlowStop();
            }
            else if (fcx.type == 3)
            {
                fc = new FlowProcessing();
            }
            else if (fcx.type == 4)
            {
                fc = new FlowDecision();
            }
            fc.SetComponentContainer(this);
            this.flowComponents.Add(fc as Control);
            this.pnlMain.Controls.Add(fc as Control);
            fc.SetDataBinding(fcx.data);
            fc.SetName(fcx.data.Name);
            (fc as Control).Left = fcx.left;
            (fc as Control).Top  = fcx.top;
            if (fcx.next1 != null)
            {
                fc.SetDefaultNextControl(RebuildUI(fcx.next1) as Control);
            }
            if (fcx.next2 != null)
            {
                (fc as FlowDecision).SetNegationNextControl(RebuildUI(fcx.next2) as Control);
            }
            return(fc);
        }