示例#1
0
        /// <summary>
        /// Position the label and two ports relative to the icon.
        /// </summary>
        /// <param name="childchanged"></param>
        /// <remarks>
        /// When <see cref="P:Northwoods.Go.GoObject.Initializing" /> is true, this method does nothing.
        /// This method also does nothing if there is no <see cref="P:Northwoods.Go.GoSimpleNode.Icon" />.
        /// </remarks>
        public override void LayoutChildren(GoObject childchanged)
        {
            if (base.Initializing)
            {
                return;
            }
            GoObject icon = Icon;

            if (icon == null)
            {
                return;
            }
            if (Orientation == Orientation.Horizontal)
            {
                if (Label != null)
                {
                    Label.SetSpotLocation(32, icon, 128);
                }
                if (InPort != null)
                {
                    InPort.SetSpotLocation(64, icon, 256);
                }
                if (OutPort != null)
                {
                    OutPort.SetSpotLocation(256, icon, 64);
                }
            }
            else
            {
                if (Label != null)
                {
                    Label.SetSpotLocation(256, icon, 64);
                }
                if (InPort != null)
                {
                    InPort.SetSpotLocation(128, icon, 32);
                }
                if (OutPort != null)
                {
                    OutPort.SetSpotLocation(32, icon, 128);
                }
            }
        }