Esempio n. 1
0
 /// <summary>
 /// This updates any internal structures needed to keep the marginal areas
 /// up-to-date with the <see cref="P:Northwoods.Go.GoSheet.TopLeftMargin" /> and <see cref="P:Northwoods.Go.GoSheet.BottomRightMargin" />
 /// properties.
 /// </summary>
 /// <param name="childchanged"></param>
 /// <remarks>
 /// This does nothing if <see cref="P:Northwoods.Go.GoObject.Initializing" /> is true.
 /// If there is a <see cref="P:Northwoods.Go.GoSheet.BackgroundImage" />, it is positioned relative to the <see cref="P:Northwoods.Go.GoSheet.MarginBounds" />
 /// according to the <see cref="P:Northwoods.Go.GoSheet.BackgroundImageSpot" />.
 /// If there is a <see cref="P:Northwoods.Go.GoSheet.Grid" />, it gets the same Bounds as the <see cref="P:Northwoods.Go.GoSheet.Paper" />.
 /// </remarks>
 public override void LayoutChildren(GoObject childchanged)
 {
     if (!base.Initializing)
     {
         base.LayoutChildren(childchanged);
         SizeF      topLeftMargin     = TopLeftMargin;
         SizeF      bottomRightMargin = BottomRightMargin;
         RectangleF marginBounds      = MarginBounds;
         if (BackgroundImage != null)
         {
             BackgroundImage.SetSpotLocation(BackgroundImageSpot, GetRectangleSpotLocation(marginBounds, BackgroundImageSpot));
         }
         GoObject goObject = Paper;
         if (goObject == null)
         {
             goObject = this;
         }
         if (Grid != null)
         {
             Grid.Bounds = goObject.Bounds;
         }
         if (topLeftMargin.Width + bottomRightMargin.Width > goObject.Width)
         {
             topLeftMargin.Width     = goObject.Width / 2f;
             bottomRightMargin.Width = goObject.Width / 2f;
         }
         if (topLeftMargin.Height + bottomRightMargin.Height > goObject.Height)
         {
             topLeftMargin.Height     = goObject.Height / 2f;
             bottomRightMargin.Height = goObject.Height / 2f;
         }
         if (myLeft != null)
         {
             myLeft.Bounds = new RectangleF(marginBounds.X - topLeftMargin.Width, marginBounds.Y, topLeftMargin.Width, marginBounds.Height);
         }
         if (myRight != null)
         {
             myRight.Bounds = new RectangleF(marginBounds.X + marginBounds.Width, marginBounds.Y, bottomRightMargin.Width, marginBounds.Height);
         }
         if (myTop != null)
         {
             myTop.Bounds = new RectangleF(marginBounds.X - topLeftMargin.Width, marginBounds.Y - topLeftMargin.Height, marginBounds.Width + topLeftMargin.Width + bottomRightMargin.Width, topLeftMargin.Height);
         }
         if (myBottom != null)
         {
             myBottom.Bounds = new RectangleF(marginBounds.X - topLeftMargin.Width, marginBounds.Y + marginBounds.Height, marginBounds.Width + topLeftMargin.Width + bottomRightMargin.Width, bottomRightMargin.Height);
         }
     }
 }