Exemple #1
0
        public void LineMoved(object sender, ItemMovedArgs args)
        {
            if (args.lineAffected.id != serial.id)
                return;
            if ((!isdrawnbackwards && args.pinDirection == pinDirection.input) ||
                (isdrawnbackwards && args.pinDirection == pinDirection.output))
                end = args.point;

               if ((!isdrawnbackwards && args.pinDirection == pinDirection.output) ||
               (isdrawnbackwards && args.pinDirection == pinDirection.input))
                start = args.point;
        }
        public void alignWires()
        {
            foreach (pin thisPin in this.conPins.Keys)
            {
                if (thisPin.isConnected)
                {
                    PictureBox icon = this.conPins[thisPin];
                    int midIcon = (icon.Height/2) + this.Parent.PointToClient(this.PointToScreen(icon.Location)).Y;
                    int iconEdge = this.Parent.PointToClient(this.PointToScreen(icon.Location)).X;
                    if (thisPin.direction == pinDirection.output)
                        iconEdge += icon.Width;
                    else
                        iconEdge -= 3;

                        if (this.OnRuleItemMoved != null)
                        {
                            ItemMovedArgs arg = new ItemMovedArgs
                                                    {
                                                        point = new Point(iconEdge, midIcon),
                                                        pinDirection = thisPin.direction,
                                                        lineAffected = thisPin.parentLineChain
                                                    };
                            this.OnRuleItemMoved.Invoke(this, arg);
                        }
                }
            }
        }