/// <summary> /// Position all of the left and right port objects at the sides of each of the items. /// </summary> /// <param name="childchanged"></param> /// <remarks> /// When <see cref="P:Northwoods.Go.GoObject.Initializing" /> is true, this method does nothing. /// </remarks> public override void LayoutChildren(GoObject childchanged) { if (!base.Initializing && myListGroup != null) { base.Initializing = true; if (TopPort != null) { TopPort.SetSpotLocation(128, myListGroup, 32); } if (BottomPort != null) { BottomPort.SetSpotLocation(32, myListGroup, 128); } int num = 0; foreach (GoObject item in myListGroup) { if (item != null && num < myLeftPorts.Count) { GoObject goObject = myLeftPorts[num]; if (goObject != null) { if (item.Visible) { PointF spotLocation = item.GetSpotLocation(256); spotLocation.X = myListGroup.Left; goObject.SetSpotLocation(64, spotLocation); } else { goObject.SetSpotLocation(64, new PointF(myListGroup.Left, item.Top)); } } } if (item != null && num < myRightPorts.Count) { GoObject goObject2 = myRightPorts[num]; if (goObject2 != null) { if (item.Visible) { PointF spotLocation2 = item.GetSpotLocation(64); spotLocation2.X = myListGroup.Right; goObject2.SetSpotLocation(256, spotLocation2); } else { goObject2.SetSpotLocation(256, new PointF(myListGroup.Right, item.Top)); } } } num = checked (num + 1); } base.Initializing = false; } }
/// <summary> /// Position the <see cref="P:Northwoods.Go.GoButton.Icon" /> to the left of the <see cref="P:Northwoods.Go.GoButton.Label" />, /// and surround both with the <see cref="P:Northwoods.Go.GoButton.Background" />, leaving /// <see cref="P:Northwoods.Go.GoButton.TopLeftMargin" /> and <see cref="P:Northwoods.Go.GoButton.BottomRightMargin" /> space /// along the sides. /// </summary> /// <param name="childchanged"></param> public override void LayoutChildren(GoObject childchanged) { if (base.Initializing) { return; } GoObject background = Background; GoText label = Label; GoObject icon = Icon; if (icon != null && label != null) { icon.SetSpotLocation(64, label, 256); } if (background == null) { return; } RectangleF bounds = Bounds; if (label != null) { bounds = label.Bounds; } else { if (icon == null) { return; } bounds = icon.Bounds; } if (icon != null && label != null) { bounds.X -= icon.Width; bounds.Width += icon.Width; if (icon.Height > label.Height) { bounds.Y -= (icon.Height - label.Height) / 2f; bounds.Height = icon.Height; } } SizeF topLeftMargin = TopLeftMargin; SizeF bottomRightMargin = BottomRightMargin; bounds.X -= topLeftMargin.Width; bounds.Width += topLeftMargin.Width + bottomRightMargin.Width; bounds.Y -= topLeftMargin.Height; bounds.Height += topLeftMargin.Height + bottomRightMargin.Height; background.Bounds = bounds; }