Example #1
0
        public override void Idle(Microsoft.Xna.Framework.GameTime gameTime)
        {
            //Don't allow the children to have an alignment.
            foreach (DrawBox box in DrawBoxList)
            {
                box.Alignment = DrawBoxAlignment.GetEmpty();
            }

            for (int x = 0; x < SlotArray.GetLength(0); x++)
            {
                for (int y = 0; y < SlotArray.GetLength(1); y++)
                {
                    if (SlotArray[x, y] == null || SlotArray[x, y].DrawBox == null)
                    {
                        continue;
                    }

                    int w = (from wx in Enumerable.Range(0, x) select cellWidths[wx]).Sum();
                    SlotArray[x, y].DrawBox.X = w + x * (MarginX) + (cellWidths[x] / 2) - SlotArray[x, y].DrawBox.Width / 2;

                    int h = (from hy in Enumerable.Range(0, y) select cellHeights[hy]).Sum();
                    SlotArray[x, y].DrawBox.Y = h + y * (MarginY) + (cellHeights[y] / 2) - SlotArray[x, y].DrawBox.Height / 2;
                }
            }
        }
Example #2
0
        public override void AddedToContainer()
        {
            Panel = new GridPanel();
            Panel.Initialize(gridWidth, gridHeight);

            const int defaultRowWidth = 100;

            RowWidths = new int[gridWidth];
            for (int n = 0; n < RowWidths.Length; n++)
            {
                RowWidths[n] = defaultRowWidth;
            }

            AddDrawBox(Panel);
            Panel.X = BorderMargin;
            Panel.Y = BorderMargin;
            Wrap();
            Width  += BorderMargin;
            Height += BorderMargin;

            Panel.Alignment           = DrawBoxAlignment.GetEmpty();
            CanResizeFormHorizontally = false;
            CanResizeFormVertically   = false;
        }