Ejemplo n.º 1
0
 public EIBNodeConnectorBase()
 {
     /*this.SetStyle(ControlStyles.DoubleBuffer, true);
      * this.SetStyle(ControlStyles.UserPaint, true);
      * this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);*/
     this.linecmenu  = new System.Windows.Forms.ContextMenu();
     this.centerMark = new MarkControl();
     this.centerMark.parentConnector = this;
 }
Ejemplo n.º 2
0
        void centerMark_MouseClick(object sender, MouseEventArgs e)
        {
            MarkControl          markControl      = (MarkControl)sender;
            EIBNodeConnectorBase selnodeConnector = (EIBNodeConnectorBase)markControl.parentConnector;
            Graphics             g = null;

            g = Graphics.FromImage(baseFrame.BackgroundImage);
            g.Clear(baseFrame.BackColor);

            foreach (Line l in ((BaseWindow)this.baseFrame.Parent).Lines)
            {
                EIBNodeConnectorBase nodeConnector = (EIBNodeConnectorBase)l.centerMark.parentConnector;
                int centerMarkX = (nodeConnector.mark1.Center.X + nodeConnector.mark2.Center.X) / 2;
                int centerMarkY = (nodeConnector.mark1.Center.Y + nodeConnector.mark2.Center.Y) / 2;
                if (!l.isDeleted)
                {
                    if (l.centerMark.parentConnector != selnodeConnector)
                    {
                        l.centerMark.parentConnector.isSelected = false;
                    }
                    else
                    {
                        l.centerMark.parentConnector.isSelected = true;
                    }
                    if (l.centerMark.parentConnector.isSelected)
                    {
                        Pen redPen = new Pen(Color.Red, (float)2);
                        g.DrawLine(redPen, nodeConnector.mark1.Center.X, nodeConnector.mark1.Center.Y, centerMarkX, centerMarkY);
                        g.DrawLine(redPen, centerMarkX, centerMarkY, nodeConnector.mark2.Center.X, nodeConnector.mark2.Center.Y);
                    }
                    else
                    {
                        Pen royalBluePen = new Pen(Color.RoyalBlue, (float)2);
                        g.DrawLine(royalBluePen, nodeConnector.mark1.Center.X, nodeConnector.mark1.Center.Y, centerMarkX, centerMarkY);
                        g.DrawLine(royalBluePen, centerMarkX, centerMarkY, nodeConnector.mark2.Center.X, nodeConnector.mark2.Center.Y);
                    }
                }
            }
            baseFrame.Invalidate();
            //baseFrame.Update();
            g.Dispose();
        }
Ejemplo n.º 3
0
        void centerMark_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            MarkControl          markControl      = (MarkControl)sender;
            EIBNodeConnectorBase selnodeConnector = (EIBNodeConnectorBase)markControl.parentConnector;
            Graphics             g = null;

            g = Graphics.FromImage(baseFrame.BackgroundImage);
            g.Clear(baseFrame.BackColor);

            foreach (Line l in ((BaseWindow)this.baseFrame.Parent).Lines)
            {
                EIBNodeConnectorBase nodeConnector = (EIBNodeConnectorBase)l.centerMark.parentConnector;
                int centerMarkX = (nodeConnector.mark1.Center.X + nodeConnector.mark2.Center.X) / 2;
                int centerMarkY = (nodeConnector.mark1.Center.Y + nodeConnector.mark2.Center.Y) / 2;
                if (!l.isDeleted)
                {
                    if (l.centerMark.parentConnector != selnodeConnector)
                    {
                        l.centerMark.parentConnector.isSelected = false;
                    }
                    else
                    {
                        l.centerMark.parentConnector.isSelected = true;
                    }
                    if (l.centerMark.parentConnector.isSelected)
                    {
                        Pen redPen = new Pen(Color.Red, (float)2);
                        g.DrawLine(redPen, nodeConnector.mark1.Center.X, nodeConnector.mark1.Center.Y, centerMarkX, centerMarkY);
                        g.DrawLine(redPen, centerMarkX, centerMarkY, nodeConnector.mark2.Center.X, nodeConnector.mark2.Center.Y);
                        NodeRelationManager nodeRelation = new NodeRelationManager();
                        nodeRelation.eibRelation1.firstTableName.Items.Add(nodeConnector.mark1.WorkFlowNode.WorkFlowNodeId);
                        nodeRelation.eibRelation1.secondTableName.Items.Add(nodeConnector.mark2.WorkFlowNode.WorkFlowNodeId);
                        nodeRelation.eibRelation1.firstTableName.SelectedIndex  = 0;
                        nodeRelation.eibRelation1.secondTableName.SelectedIndex = 0;
                        nodeRelation.eibRelation1.relationName.Text             = nodeConnector.ControlName;
                        nodeRelation.ShowDialog();
                    }
                    else
                    {
                        Pen royalBluePen = new Pen(Color.RoyalBlue, (float)2);
                        g.DrawLine(royalBluePen, nodeConnector.mark1.Center.X, nodeConnector.mark1.Center.Y, centerMarkX, centerMarkY);
                        g.DrawLine(royalBluePen, centerMarkX, centerMarkY, nodeConnector.mark2.Center.X, nodeConnector.mark2.Center.Y);
                    }
                }
            }
            baseFrame.Invalidate();
            baseFrame.Update();
            g.Dispose();

            /*EIBNodeConnectorBase nodeConnector = (EIBNodeConnectorBase)markControl.parentConnector;
             * Graphics g = null;
             * g = Graphics.FromImage(baseFrame.BackgroundImage);
             * int centerMarkX = (nodeConnector.mark1.Center.X + nodeConnector.mark2.Center.X) / 2;
             * int centerMarkY = (nodeConnector.mark1.Center.Y + nodeConnector.mark2.Center.Y) / 2;
             * //
             * foreach (Line l in ((BaseWindow)this.baseFrame.Parent).Lines)
             * {
             *  if (!l.isDeleted)
             *  {
             *      if (!isSelected)
             *      {
             *          isSelected = true;
             *          g.DrawLine(new Pen(Color.Red, (float)2), nodeConnector.mark1.Center.X, nodeConnector.mark1.Center.Y, centerMarkX, centerMarkY);
             *          g.DrawLine(new Pen(Color.Red, (float)2), centerMarkX, centerMarkY, nodeConnector.mark2.Center.X, nodeConnector.mark2.Center.Y);
             *
             *
             *      }
             *      else
             *      {
             *          isSelected = false;
             *          g.DrawLine(new Pen(Color.RoyalBlue, (float)2), nodeConnector.mark1.Center.X, nodeConnector.mark1.Center.Y, centerMarkX, centerMarkY);
             *          g.DrawLine(new Pen(Color.RoyalBlue, (float)2), centerMarkX, centerMarkY, nodeConnector.mark2.Center.X, nodeConnector.mark2.Center.Y);
             *      }
             *  }
             *  baseFrame.Invalidate();
             *  baseFrame.Update();
             * }
             * g.Dispose();*/
        }