public virtual PointF GetLinkPoint(int spot)
        {
            int num1 = spot;

            if (num1 <= 0x40)
            {
                if (num1 == 0x20)
                {
                    RectangleF ef3 = this.Bounds;
                    PointF     tf3 = new PointF(ef3.X + (ef3.Width / 2f), ef3.Y);
                    GeneralNodePortLabelText label3 = this.Label;
                    if ((label3 != null) && label3.Visible)
                    {
                        tf3.Y -= (label3.Height + this.LabelSpacing);
                    }
                    return(tf3);
                }
                if (num1 == 0x40)
                {
                    RectangleF ef2 = this.Bounds;
                    PointF     tf2 = new PointF(ef2.X + ef2.Width, ef2.Y + (ef2.Height / 2f));
                    GeneralNodePortLabelText label2 = this.Label;
                    if ((label2 != null) && label2.Visible)
                    {
                        tf2.X += (label2.Width + this.LabelSpacing);
                    }
                    return(tf2);
                }
            }
            else
            {
                if (num1 == 0x80)
                {
                    RectangleF ef4 = this.Bounds;
                    PointF     tf4 = new PointF(ef4.X + (ef4.Width / 2f), ef4.Y + ef4.Height);
                    GeneralNodePortLabelText label4 = this.Label;
                    if ((label4 != null) && label4.Visible)
                    {
                        tf4.Y += (label4.Height + this.LabelSpacing);
                    }
                    return(tf4);
                }
                if (num1 == 0x100)
                {
                    RectangleF ef1 = this.Bounds;
                    PointF     tf1 = new PointF(ef1.X, ef1.Y + (ef1.Height / 2f));
                    GeneralNodePortLabelText label1 = this.Label;
                    if ((label1 != null) && label1.Visible)
                    {
                        tf1.X -= (label1.Width + this.LabelSpacing);
                    }
                    return(tf1);
                }
            }
            return(this.GetSpotLocation(spot));
        }
Beispiel #2
0
        public virtual GeneralNodePort MakePort(bool input)
        {
            GeneralNodePort port1 = this.CreatePort(input);

            if (port1 != null)
            {
                PointF tf1;
                GeneralNodePortLabelText label1 = this.CreatePortLabel(input);
                port1.Label = label1;
                if (label1 != null)
                {
                    label1.Port = port1;
                }
                if (this.Orientation == System.Windows.Forms.Orientation.Vertical)
                {
                    port1.ToSpot   = 0x20;
                    port1.FromSpot = 0x80;
                }
                else
                {
                    port1.ToSpot   = 0x100;
                    port1.FromSpot = 0x40;
                }
                if (input)
                {
                    port1.Name = this.LeftPortsCount.ToString(CultureInfo.CurrentCulture);
                }
                else
                {
                    port1.Name = this.RightPortsCount.ToString(CultureInfo.CurrentCulture);
                }
                if (this.Icon != null)
                {
                    tf1 = this.Icon.Position;
                    if (this.Orientation == System.Windows.Forms.Orientation.Vertical)
                    {
                        if (input)
                        {
                            tf1.Y -= port1.Height;
                        }
                        else
                        {
                            tf1.Y = this.Icon.Bottom;
                        }
                    }
                    else if (input)
                    {
                        tf1.X -= port1.Width;
                    }
                    else
                    {
                        tf1.X = this.Icon.Right;
                    }
                }
                else
                {
                    tf1 = base.Position;
                }
                port1.Position = tf1;
                if (label1 != null)
                {
                    label1.Position = tf1;
                }
            }
            return(port1);
        }