Esempio n. 1
0
        private void Drawable_MouseUp(object sender, MouseEventArgs e)
        {
            if (!_moveSeparator && e.Location.X >= _separatorPos && _selectedCell != null && _selectedCell.Editable && !_skipEdit)
            {
                var action = new Action(() =>
                {
                    if (Global.IsGtk && !_selectedCell.HasDialog)
                    {
                        pixel1.RemoveAll();
                        pixel1 = new PixelLayout();
                        pixel1.Add(drawable, 0, 0);
                        _selectedCell.Edit(pixel1);
                        Content = pixel1;
                    }
                    else
                    {
                        _selectedCell.Edit(pixel1);
                    }

                    drawable.Invalidate();
                });

#if WINDOWS
                (drawable.ControlObject as System.Windows.Controls.Canvas).Dispatcher.BeginInvoke(action,
                                                                                                  System.Windows.Threading.DispatcherPriority.ContextIdle, null);
#else
                action.Invoke();
#endif
            }
            else
            {
                _moveSeparator = false;
            }
        }
Esempio n. 2
0
        Control LargeCanvas()
        {
            var control = new Drawable {
                Size            = new Size(1000, 1000),
                BackgroundColor = Colors.Blue
            };
            var image = Bitmap.FromResource("Eto.Test.TestImage.png");

            control.Paint += delegate(object sender, PaintEventArgs pe) {
                pe.Graphics.FillRectangle(Colors.Black, new Rectangle(150, 150, 100, 100));
                var inc = 400;
                for (int i = 0; i <= control.Size.Width / inc; i++)
                {
                    var pos = i * inc;
                    pe.Graphics.DrawLine(Colors.White, new Point(pos, 0), new Point(pos + control.Size.Width, control.Size.Height));
                    pe.Graphics.DrawLine(Colors.White, new Point(pos, 0), new Point(pos - control.Size.Width, control.Size.Height));
                }
                var lpos = 100;
                pe.Graphics.DrawLine(Colors.White, new Point(0, lpos), new Point(control.Size.Width, lpos));
                pe.Graphics.DrawLine(Colors.White, new Point(lpos, 0), new Point(lpos, control.Size.Height));
                pe.Graphics.DrawImage(image, 100, 10);
                pe.Graphics.DrawImage(image, 250, 10, 80, 20);
            };
            LogEvents(control);

            var layout = new PixelLayout(new Scrollable {
                Size = new Size(450, 250)
            });

            layout.Add(control, 25, 25);
            return(layout.Container);
        }
Esempio n. 3
0
        public RadioButtonPanel(int width, int height, string title, string[] choiceNames, string[] buttonTexts) : base(width, height, 38, 46, title)
        {
            // Buttons
            Button = new Civ2button[buttonTexts.Length];
            int btnW = (this.Width - 2 * 9 - 3 * (buttonTexts.Length - 1)) / buttonTexts.Length;  // Determine width of one button

            for (int i = 0; i < buttonTexts.Length; i++)
            {
                Button[i] = new Civ2button(buttonTexts[i], btnW, 36, new Font("Times new roman", 11));
                MainPanelLayout.Add(Button[i], 9 + btnW * i + 3 * i, Height - 46);
            }

            // Radio buttons
            var layout2    = new PixelLayout();
            var controller = new RadioButton();

            RadioBtn = new RadioButton[choiceNames.Length];
            for (int row = 0; row < choiceNames.Length; row++)
            {
                RadioBtn[row] = new RadioButton(controller)
                {
                    Text = choiceNames[row], Font = new Font("Times new roman", 18), Size = new Size(InnerPanel.Width, 33), TextColor = Color.FromArgb(51, 51, 51)
                };
                layout2.Add(RadioBtn[row], 10, row * 33);
            }
            layout2.Size       = new Size(InnerPanel.Width, InnerPanel.Height);
            InnerPanel.Content = layout2;

            MainPanel.Content = MainPanelLayout;
        }
        public CheckboxPanel(int width, int height, string title, string[] _checkboxNames, string[] buttonTexts) : base(width, height, 38, 46, title)
        {
            checkboxNames = _checkboxNames;

            // Buttons
            Button = new Civ2button[buttonTexts.Length];
            int btnW = (this.Width - 2 * 9 - 3 * (buttonTexts.Length - 1)) / buttonTexts.Length;  // Determine width of one button

            for (int i = 0; i < buttonTexts.Length; i++)
            {
                Button[i] = new Civ2button(buttonTexts[i], btnW, 36, new Font("Times new roman", 11));
                MainPanelLayout.Add(Button[i], 9 + btnW * i + 3 * i, Height - 46);
            }

            var InnerPanelLayout = new PixelLayout();

            InnerPanelLayout.Size = new Size(width, height);

            // Make checkbox fields for each option
            CheckboxFields = new List <Panel>();
            for (int i = 0; i < checkboxNames.Length; i++)
            {
                var panel = new Panel
                {
                    BackgroundColor = Colors.Transparent
                };
                InnerPanelLayout.Add(panel, 10, 32 * i + 4);
                panel.MouseDown += CheckboxFields_Click;
                CheckboxFields.Add(panel);
            }

            InnerPanel.Paint  += InnerPanel_Paint;
            InnerPanel.Content = InnerPanelLayout;
        }
Esempio n. 5
0
        public override void Edit(PixelLayout control)
        {
            _draw = false;

            var checkbox = new CheckBox();

            checkbox.Tag     = this;
            checkbox.Checked = (bool)Value;
            checkbox.Text    = DisplayValue;
            checkbox.Width   = _lastRec.Width - 10;
            checkbox.Height  = _lastRec.Height;
            control.Add(checkbox, _lastRec.X + 10, _lastRec.Y);

            checkbox.CheckedChanged += (sender, e) => checkbox.Text = checkbox.Checked.ToString();

            OnKill += delegate
            {
                OnKill = null;

                if (_eventHandler == null)
                {
                    return;
                }

                _draw = true;
                Value = checkbox.Checked;
                _eventHandler(Value, EventArgs.Empty);
            };
        }
Esempio n. 6
0
        private void InitializeComponent()
        {
            BackgroundColor = DrawInfo.BackColor;

            pixel1 = new PixelLayout();
            pixel1.BackgroundColor = DrawInfo.BackColor;

            drawable        = new Drawable();
            drawable.Height = 100;
            pixel1.Add(drawable, 0, 0);

            Content = pixel1;

            pixel1.Style   = "Stretch";
            drawable.Style = "Stretch";

#if MONOMAC
            drawable.Width = 10;
#endif

            drawable.Paint      += Drawable_Paint;
            drawable.MouseDown  += Drawable_MouseDown;
            drawable.MouseUp    += Drawable_MouseUp;
            drawable.MouseMove  += Drawable_MouseMove;
            drawable.MouseLeave += Drawable_MouseLeave;
            SizeChanged         += PropertyGridTable_SizeChanged;
        }
Esempio n. 7
0
        public override void Edit(PixelLayout control)
        {
            SkipCellDraw = true;

            var checkbox = new CheckBox();

            checkbox.Tag        = this;
            checkbox.Checked    = (bool?)Value;
            checkbox.ThreeState = (Value == null);
            checkbox.Text       = (checkbox.Checked == null) ? "Not Set" : checkbox.Checked.ToString();
            checkbox.Width      = _lastRec.Width - 10;
            checkbox.Height     = _lastRec.Height;
            control.Add(checkbox, _lastRec.X + 10, _lastRec.Y);

            checkbox.CheckedChanged += (sender, e) => checkbox.Text = (checkbox.Checked == null) ? "Not Set" : checkbox.Checked.ToString();

            OnKill += delegate
            {
                SkipCellDraw = false;
                OnKill       = null;

                if (_eventHandler == null || checkbox.Checked == null)
                {
                    return;
                }

                Value = checkbox.Checked;
                _eventHandler(Value, EventArgs.Empty);
            };
        }
Esempio n. 8
0
        public override void Edit(PixelLayout control)
        {
            var editText = new TextBox();

            editText.Tag    = this;
            editText.Style  = "OverrideSize";
            editText.Width  = _lastRec.Width;
            editText.Height = _lastRec.Height;
            editText.Text   = (Value == null) ? "" : Value.ToString();

            control.Add(editText, _lastRec.X, _lastRec.Y);

            editText.Focus();
            editText.CaretIndex = editText.Text.Length;

            OnKill += delegate
            {
                OnKill = null;

                if (_eventHandler == null)
                {
                    return;
                }

                _eventHandler(editText.Text, EventArgs.Empty);
            };

            editText.KeyDown += (sender, e) =>
            {
                if (e.Key == Keys.Enter)
                {
                    OnKill.Invoke();
                }
            };
        }
Esempio n. 9
0
        public Civ2panel(int width, int height, int paddingTopInnerPanel, int paddingBtmInnerPanel, string title = null)
        {
            Size        = new Size(width, height);
            _paddingTop = paddingTopInnerPanel;
            _paddingBtm = paddingBtmInnerPanel;
            _title      = title;

            // Main panel
            MainPanel = new Drawable()
            {
                Size = new Size(width, height)
            };
            MainPanel.Paint += MainPanel_Paint;

            // Inner panel
            MainPanelLayout      = new PixelLayout();
            MainPanelLayout.Size = new Size(MainPanel.Width, MainPanel.Height);
            InnerPanel           = new Drawable()
            {
                Size = new Size(MainPanel.Width - 2 * 11, MainPanel.Height - _paddingTop - _paddingBtm)
            };
            InnerPanel.Paint += InnerPanel_Paint;
            MainPanelLayout.Add(InnerPanel, 11, _paddingTop);
            MainPanel.Content = MainPanelLayout;

            Content = MainPanel;

            InnerPanelLayout      = new PixelLayout();
            InnerPanelLayout.Size = new Size(width, height);
        }
Esempio n. 10
0
        public void LabelsShouldGetCorrectSize()
        {
            ManualForm("Labels should end with a period", form => {
                // note: this actually failed only when the form was the initial window, as it calculated its size before it was even shown.
                form.ClientSize = new Size(200, 200);

                var layout = new PixelLayout();
                layout.Add(new Label {
                    Text = "Hello world.", BackgroundColor = Colors.Yellow, TextColor = Colors.Black
                }, 50, 50);
                layout.Add(new Label {
                    Text = "Bonjour monde.", BackgroundColor = Colors.LightGreen, TextColor = Colors.Black
                }, 20, 20);
                form.Content = layout;
                return(layout);
            });
        }
Esempio n. 11
0
        private void ChangeNodeType(object sender, EventArgs e)
        {
            pxlViewport.RemoveAll();

            if (rdoCheckBox.Checked)
            {
                pxlViewport.Add(nodeCheckBox, 0, 0);
            }
            else if (rdoPanel.Checked)
            {
                pxlViewport.Add(nodePanel, 0, 0);
            }
            else if (rdoWindowsFormsHost.Checked)
            {
                pxlViewport.Add(nodeWindowsFormsHost, 0, 0);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainForm"/> class.
        /// </summary>
        public MainForm()
        {
            Title      = "My Eto Form";
            ClientSize = new Size(800, 600);

            gfx = new GFXBoxControl();

            PixelLayout layout = new PixelLayout();

            layout.Add(gfx, 5, 5);

            grid = new OAMTileGrid
            {
                AddingTiles = () => gfx.Selection
            };

            UnityGraphicBox gr = new UnityGraphicBox(new UnityTileSize(16, 16));

            gr.Load("image.png", 0);


            SpriteTileSection s = new SpriteTileSection();

            s.Add(new TileMaskCollection(BytesPerPixel.RGB555));
            SpriteTileSectionMask m = new SpriteTileSectionMask(s);

            grid.Target = m;

            scrolleablePanel = new Scrollable
            {
                Width  = 512,
                Height = 512,
                Border = BorderType.None
            };
            PixelLayout scrollLayout = new PixelLayout();

            scrollLayout.Add(grid, 0, 0);
            scrolleablePanel.Content = scrollLayout;
            scrolleablePanel.Scroll += scroll;

            layout.Add(scrolleablePanel, 266, 5);
            grid.VisibleRectangle = scrolleablePanel.VisibleRect;

            Content = layout;
        }
        private Control GenAddMoreDropInArea(Action <string> actionAfterNewDroppedIn)
        {
            var width  = _leftControlsWith;
            var height = 60;

            var layerPanel  = new PixelLayout();
            var dropInValue = new Label();

            dropInValue.Text              = "Drag a new material from library";
            dropInValue.TextColor         = Colors.DimGray;
            dropInValue.TextAlignment     = TextAlignment.Center;
            dropInValue.VerticalAlignment = VerticalAlignment.Center;

            dropInValue.Width  = width;
            dropInValue.Height = height;
            var backGround = Eto.Drawing.Color.FromArgb(230, 230, 230);

            dropInValue.BackgroundColor = backGround;

            var dropIn = new Drawable();

            dropIn.AllowDrop       = true;
            dropIn.Width           = width;
            dropIn.Height          = height;
            dropIn.BackgroundColor = Colors.Transparent;

            dropIn.DragLeave += (sender, e) =>
            {
                dropInValue.BackgroundColor = backGround;
            };
            dropIn.DragOver += (sender, e) =>
            {
                e.Effects = DragEffects.Move;
                dropInValue.BackgroundColor = Colors.LightGrey;
            };
            dropIn.DragDrop += (sender, e) =>
            {
                var newValue = e.Data.GetString("HBObj");
                //dropInValue.Text = newValue;
                actionAfterNewDroppedIn(newValue);
            };
            layerPanel.Add(dropInValue, 0, 0);
            layerPanel.Add(dropIn, 0, 0);
            return(layerPanel);
        }
Esempio n. 14
0
        Control PixelLayout()
        {
            var control = new PixelLayout();

            control.Add(new TextArea
            {
                Text = "Some text that is contained in a pixel layout."
            }, Point.Empty);
            return(control);
        }
Esempio n. 15
0
        private void GameOptionsCommand_Click(object sender, EventArgs e)
        {
            var GameOptionsPanel = new GameOptionsPanel();

            layout.Add(GameOptionsPanel, this.Width / 2 - GameOptionsPanel.Width / 2, this.Height / 2 - GameOptionsPanel.Height / 2);
            foreach (MenuItem item in Menu.Items)
            {
                item.Enabled = false;
            }
            suppressKeyEvent = true;
        }
Esempio n. 16
0
        Control Default()
        {
            var layout = new PixelLayout();

            layout.Add(new Label {
                BackgroundColor = Colors.Red, Text = "Expanded Width/Height (default)"
            }, 50, 50);

            defaultScrollable.Content = layout;
            return(defaultScrollable);
        }
Esempio n. 17
0
        Control ExpandedHeight()
        {
            var layout = new PixelLayout();

            layout.Add(new Label {
                BackgroundColor = Colors.Red, Text = "Expanded Height"
            }, 50, 50);
            return(new Scrollable {
                ExpandContentWidth = false, Content = layout
            });
        }
Esempio n. 18
0
        void CreateButton(PixelLayout layout, int index, int x, int y)
        {
            var b = new SelectColourBox {
                Pad     = this,
                Size    = new Size(16, 16),
                Index   = index,
                Enabled = index < Palette.Count
            };

            colours[index] = b;
            layout.Add(b, x, y);
        }
Esempio n. 19
0
        Control DefaultScrollable()
        {
            var scrollable = new Scrollable {
                Size = new Size(100, 200)
            };

            LogEvents(scrollable);
            var playout = new PixelLayout(scrollable);

            playout.Add(new LabelSection {
                Size = new Size(400, 400)
            }, 0, 0);
            return(playout.Container);
        }
Esempio n. 20
0
        Control LineScrollable()
        {
            var scrollable = new Scrollable {
                Size = new Size(100, 200), Border = BorderType.Line
            };

            LogEvents(scrollable);
            var playout = new PixelLayout(scrollable);

            playout.Add(new LabelSection {
                Size = new Size(400, 400)
            }, 0, 0);
            return(playout.Container);
        }
Esempio n. 21
0
        public Civ2customDialog(Main parent, int width, int height, int paddingTopInnerPanel = 38, int paddingBtmInnerPanel = 46, string title = null)
        {
            foreach (MenuItem item in parent.Menu.Items)
            {
                item.Enabled = false;
            }
            WindowStyle = WindowStyle.None;

            // Drag window
            this.MouseDown += (_, e) =>
            {
                if (e.Location.Y < _paddingTop)  // Enable dragging only on top of window
                {
                    dragging        = true;
                    dragCursorPoint = this.Location + e.Location;
                    dragFormPoint   = this.Location;
                }
            };

            this.MouseMove += (_, e) =>
            {
                if (dragging)
                {
                    dif           = this.Location + e.Location - dragCursorPoint;
                    this.Location = (Point)(dragFormPoint + dif);
                }
            };

            this.MouseUp += (_, _) => dragging = false;

            Size        = new Size(width, height);
            _paddingTop = paddingTopInnerPanel;
            _paddingBtm = paddingBtmInnerPanel;
            _title      = title;

            Layout = new PixelLayout()
            {
                Size = new Size(width, height)
            };

            // Drawable surface
            Surface = new Drawable()
            {
                Size = new Size(width, height), CanFocus = false
            };
            Surface.Paint += Surface_Paint;

            Layout.Add(Surface, 0, 0);
        }
Esempio n. 22
0
        void Init()
        {
            var label1 = new Label
            {
                Text = "Welcome to",
                Font = new Font(FontFamilies.Monospace, 30)
            };
            var labelTitle = new Label
            {
                Text = "Altman3",
                Font = new Font(FontFamilies.Monospace, 60)
            };

            var layout = new PixelLayout();

            layout.Add(label1, new Point(70, 50));
            layout.Add(labelTitle, new Point(100, 120));

            var logo = PluginServiceProvider.GetService("ToFingerBinary");

            if (logo != null)
            {
                var rnd = new Random();
                var par = new PluginParameter();
                par.AddParameter("str", rnd.Next(1, 1023));
                var ret = logo(par);
                var tmp = new Label
                {
                    Text = ret,
                    Font = new Font(FontFamilies.Monospace, 10)
                };
                layout.Add(tmp, new Point(300, 220));
            }

            Content = layout;
        }
Esempio n. 23
0
        Control BezelScrollable()
        {
            var scrollable = new Scrollable {
                Size = new Size(100, 200), Border = BorderType.Bezel
            };

            LogEvents(scrollable);
            var playout = new PixelLayout();

            playout.Add(new LabelSection {
                Size = new Size(400, 400)
            }, 0, 0);
            scrollable.Content = playout;
            return(scrollable);
        }
Esempio n. 24
0
        public override void Edit(PixelLayout control)
        {
            SkipCellDraw = true;
            var editText = new TextBox();

            editText.Tag    = this;
            editText.Style  = "OverrideSize";
            editText.Width  = _lastRec.Width;
            editText.Height = _lastRec.Height;

            char value;

            char.TryParse(Value.ToString(), out value);

            editText.Text = ((int)value).ToString();

            control.Add(editText, _lastRec.X, _lastRec.Y);

            editText.Focus();
            editText.CaretIndex = editText.Text.Length;

            OnKill += delegate
            {
                SkipCellDraw = false;
                OnKill       = null;

                if (_eventHandler == null)
                {
                    return;
                }

                int num;
                if (!int.TryParse(editText.Text, out num))
                {
                    return;
                }

                _eventHandler((char)num, EventArgs.Empty);
            };

            editText.KeyDown += (sender, e) =>
            {
                if (e.Key == Keys.Enter)
                {
                    OnKill.Invoke();
                }
            };
        }
Esempio n. 25
0
 public void ChangingTextAfterCreationShouldUpdateSize()
 {
     ManualForm("Label should be fully visible", form =>
     {
         var label = new Label {
             Text = ""
         };
         Application.Instance.AsyncInvoke(() => label.Text = "This label should end with a period.");
         var layout = new PixelLayout
         {
             Size = new Size(300, 200)
         };
         layout.Add(label, 0, 0);
         return(layout);
     });
 }
Esempio n. 26
0
        void InitializeComponent()
        {
            Title           = "HVH.Client";
            BackgroundColor = Colors.White;
            Icon            = new Icon(Directory.GetCurrentDirectory() + "/assets/helmholtz_owl.ico");
            ClientSize      = new Size(280, 430);
            Resizable       = false;
            Minimizable     = false;
            Maximizable     = false;

            controls["logo"] = new ImageView {
                Image = Utility.LoadBitmap("assets/helmholtz_owl.png"), Size = new Size(200, -1)
            };
            controls["roomControl"] = new Button {
                Text = "Room Control", Size = new Size(240, 30), Enabled = Client.Instance?.Status.Type != UserType.Normal
            };
            controls["issueReport"] = new Button {
                Text = "Issue Reporting", Size = new Size(240, 30), Enabled = Client.Instance?.Status.Type != UserType.Normal
            };
            controls["adminPanel"] = new Button {
                Text = "Admin Panel", Size = new Size(240, 30), Enabled = Client.Instance?.Status.Type == UserType.Admin
            };
            controls["seperator"] = new ProgressBar
            {
                BackgroundColor = Colors.Black,
                Indeterminate   = false,
                Value           = 0,
                Size            = new Size(240, 1)
            };
            controls["logout"] = new Button {
                Text = "Logout", Size = new Size(240, 30)
            };

            // Events
            (controls["logout"] as Button).Click += delegate
            {
                Client.Instance.SendLogout();
            };
            (controls["roomControl"] as Button).Click += delegate
            {
                Application.Instance.MainForm = new RoomControlForm();
                Application.Instance.MainForm.Show();
                Visible = false;
            };
            PixelLayout layout = new PixelLayout();

            layout.Add(controls["logo"], 40, 10);
            layout.Add(controls["roomControl"], 20, 250);
            layout.Add(controls["issueReport"], 20, 290);
            layout.Add(controls["adminPanel"], 20, 330);
            layout.Add(controls["seperator"], 20, 370);
            layout.Add(controls["logout"], 20, 380);
            Content = layout;
        }
Esempio n. 27
0
 /// <summary>
 /// Displays a warning message
 /// </summary>
 public static void ShowWarning(String text, PixelLayout layout)
 {
     if (!controls.ContainsKey("warning"))
     {
         controls["warning"] = new Label
         {
             Text            = text,
             Font            = new Font("Segoe UI", 10),
             BackgroundColor = Colors.Transparent,
             TextColor       = Colors.OrangeRed,
             Size            = new Size(160, 32),
             Wrap            = WrapMode.Word
         };
         layout.Add(controls["warning"], 75, 190);
     }
     (controls["warning"] as Label).Text = text;
 }
Esempio n. 28
0
        public Civ2form(int width, int height, int paddingTopInnerPanel, int paddingBtmInnerPanel, string title = null)
        {
            WindowStyle   = WindowStyle.None;
            ShowInTaskbar = false;

            Size        = new Size(width, height);
            _paddingTop = paddingTopInnerPanel;
            _paddingBtm = paddingBtmInnerPanel;
            _title      = title;

            // Drag window
            this.MouseDown += (sender, e) =>
            {
                if (e.Location.Y < 25)  // Enable dragging only on top of window
                {
                    dragging        = true;
                    dragCursorPoint = this.Location + e.Location;
                    dragFormPoint   = this.Location;
                }
            };

            this.MouseMove += (sender, e) =>
            {
                if (dragging)
                {
                    dif           = this.Location + e.Location - dragCursorPoint;
                    this.Location = (Point)(dragFormPoint + dif);
                }
            };

            this.MouseUp += (sender, _) => dragging = false;

            Layout = new PixelLayout()
            {
                Size = Size
            };

            // Drawable surface
            Surface = new Drawable()
            {
                Size = Size, CanFocus = false
            };
            Surface.Paint += Surface_Paint;

            Layout.Add(Surface, 0, 0);
        }
Esempio n. 29
0
        public override void Edit(PixelLayout control)
        {
            SkipCellDraw = true;

            var editText = new TextBox();

            editText.Tag    = this;
            editText.Style  = "OverrideSize";
            editText.Width  = _lastRec.Width;
            editText.Height = _lastRec.Height;
            editText.Text   = DisplayValue;
            editText.Tag    = this;

            control.Add(editText, _lastRec.X, _lastRec.Y);

            editText.Focus();
            editText.CaretIndex = editText.Text.Length;

            OnKill += delegate
            {
                SkipCellDraw = false;
                OnKill       = null;

                if (_eventHandler == null)
                {
                    return;
                }

                try
                {
                    _eventHandler(_converter.ConvertFrom(editText.Text), EventArgs.Empty);
                }
                catch { }
            };

            editText.KeyDown += (sender, e) =>
            {
                if (e.Key == Keys.Enter)
                {
                    OnKill.Invoke();
                }
            };
        }
Esempio n. 30
0
        void SetButtonsPosition()
        {
            // remove the buttons
            if (PixelLayout.Children.Contains(Buttons))
            {
                PixelLayout.Remove(Buttons);
            }

            var size          = new Size(200, 200);
            var location      = Point.Empty;
            var containerSize = PixelLayout.Size;

            // X
            if (Anchor.HasFlag(Anchor.Right) && !Anchor.HasFlag(Anchor.Left))
            {
                location.X = containerSize.Width - size.Width;
            }

            // Y
            if (Anchor.HasFlag(Anchor.Bottom) && !Anchor.HasFlag(Anchor.Top))
            {
                location.Y = containerSize.Height - size.Height;
            }

            // Width
            if (Anchor.HasFlag(Anchor.Left) && Anchor.HasFlag(Anchor.Right))
            {
                size.Width = containerSize.Width;
            }

            // Height
            if (Anchor.HasFlag(Anchor.Top) && Anchor.HasFlag(Anchor.Bottom))
            {
                size.Height = containerSize.Height;
            }

            // At this point size and location are where
            // Buttons should be displayed.
            Buttons.Size = size;
            PixelLayout.Add(Buttons, location);
        }