예제 #1
0
        public void SetDefaultNextControl(Control c)
        {
            //throw new NotImplementedException();
            //facem pe draq in patru aici si adaugam controlul pe forma
            parentDiagram.SuspendLayout();
            parentDiagram.AddFlowComponent(c);
            if (fc2 == null)
            {
                fc2 = new FlowConnector(this.button2, (c as FlowComponent).GetPinInput(), parentDiagram);
                parentDiagram.AddFlowConnector(fc2);
            }

            if (fc2 != null)
            {
                fc2.SetEndControl((c as FlowComponent).GetPinInput());
            }

            c.Left = this.Left - (c.Width - this.Width) / 2;
            c.Top  = this.Bottom + 20;
            (c as FlowComponent).SlideControl(this.Width / 2, 0);
            if (NextControl != null)
            {
                (NextControl as FlowComponent).SlideControl(this.Width / 2, c.Height + 20);
                (c as FlowComponent).SetDefaultNextControl(NextControl);
            }

            this.NextControl = c;
            parentDiagram.ResumeLayout();
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            frmChooseNextComponent frmNC = new frmChooseNextComponent(this);

            frmNC.Left = Cursor.Position.X + 5;
            frmNC.Top  = Cursor.Position.Y + 5;
            frmNC.ShowDialog();
            if (frmNC.CreatedObject != null)
            {
                fc = new FlowConnector(this.button1, (frmNC.CreatedObject as FlowComponent).GetPinInput(), parentDiagram);
                parentDiagram.AddFlowConnector(fc);
                Control c = frmNC.CreatedObject;
                SetDefaultNextControl(c);
            }
        }