Exemple #1
0
        public override void Recalculate()
        {
            base.Recalculate();
            _controls.Sort(ZIndexComparer.Instance);
            _captionBarRect =
                new Rectangle(CleanRect.Left, CleanRect.Top + BorderSize, CleanRect.Width, Ui.CaptionHeight);
            _mainRect = new Rectangle(CleanRect.Left, CleanRect.Top + BorderSize + Ui.CaptionHeight, CleanRect.Width,
                                      CleanRect.Height - Ui.CaptionHeight - BorderSize);
            _closeButton.Dirty();
            for (int i = 0; i < _controls.Count; i++)
            {
                _controls[i].Dirty();
            }

            _topLeft     = new Vector2(CleanRect.Left, CleanRect.Top);
            _topRight    = new Vector2(CleanRect.Left + Width - BorderSize, CleanRect.Top);
            _bottomLeft  = new Vector2(CleanRect.Left, CleanRect.Top + Height - BorderSize);
            _bottomRight = new Vector2(CleanRect.Left + Width - BorderSize, CleanRect.Top + Height - BorderSize);

            _middleTop = new Rectangle(CleanRect.Left + BorderSize, CleanRect.Top, Width - (BorderSize * 2),
                                       BorderSize);
            _middleLeft = new Rectangle(CleanRect.Left, CleanRect.Top + BorderSize, BorderSize,
                                        Height - (BorderSize * 2));
            _middleRight = new Rectangle(CleanRect.Left + Width - BorderSize, CleanRect.Top + BorderSize, BorderSize,
                                         Height - (BorderSize * 2));
            _middleBottom = new Rectangle(CleanRect.Left + BorderSize, CleanRect.Top + Height - BorderSize,
                                          Width - (BorderSize * 2), BorderSize);

            _captionPos = new Vector2(CleanRect.Left + (_captionBarRect.Width / 2) - (_caption.MeasuredSize.X / 2),
                                      CleanRect.Top + BorderSize + 2);
            //_closeButton.SetRect(new Rectangle(CleanRect.Right - Ui.CaptionHeight - BorderSize, CleanRect.Top, Ui.CaptionHeight + BorderSize, Ui.CaptionHeight + BorderSize));

            _backgroundRects =
                Parts.CreateRectangular(CleanRect.Size, CleanRect.Left, CleanRect.Top, Ui.Background.Size);
            _captionBackgroundRects = Parts.CreateHorizontal(_captionBarRect.Width,
                                                             Ui.CaptionBackground.Width, _captionBarRect.Top, _captionBarRect.Left, Ui.CaptionHeight);
            _draggable.SetRect(new Rectangle(_captionBarRect.Left, _captionBarRect.Top, _captionBarRect.Width - Ui.CaptionHeight - BorderSize, _captionBarRect.Height));
            IsDirty = false;
        }
        public override void Recalculate()
        {
            base.Recalculate();
            _mBoxCaptionBarRect =
                new Rectangle(CleanRect.Left, CleanRect.Top + BorderSize, CleanRect.Width, CaptionHeight);
            _mBoxMainRect = new Rectangle(CleanRect.Left, CleanRect.Top + BorderSize + CaptionHeight, CleanRect.Width,
                                          CleanRect.Height - CaptionHeight - BorderSize);
            _topLeft     = new Vector2(CleanRect.Left, CleanRect.Top);
            _topRight    = new Vector2(CleanRect.Left + Width - BorderSize, CleanRect.Top);
            _bottomLeft  = new Vector2(CleanRect.Left, CleanRect.Top + Height - BorderSize);
            _bottomRight = new Vector2(CleanRect.Left + Width - BorderSize, CleanRect.Top + Height - BorderSize);

            _middleTop = new Rectangle(CleanRect.Left + BorderSize, CleanRect.Top, Width - (BorderSize * 2),
                                       BorderSize);
            _middleLeft = new Rectangle(CleanRect.Left, CleanRect.Top + BorderSize, BorderSize,
                                        Height - (BorderSize * 2));
            _middleRight = new Rectangle(CleanRect.Left + Width - BorderSize, CleanRect.Top + BorderSize, BorderSize,
                                         Height - (BorderSize * 2));
            _middleBottom = new Rectangle(CleanRect.Left + BorderSize, CleanRect.Top + Height - BorderSize,
                                          Width - (BorderSize * 2), BorderSize);

            _captionPos = new Vector2(CleanRect.Left + (_mBoxCaptionBarRect.Width / 2) - (_caption.MeasuredSize.X / 2),
                                      CleanRect.Top + BorderSize + 2);
            _textPos = new Vector2(
                _mBoxMainRect.Left + (_mBoxMainRect.Width / 2) - (_text.MeasuredSize.X / 2),
                _mBoxMainRect.Top + ((_mBoxMainRect.Height - ButtonHeight) / 2) - (_text.MeasuredSize.Y / 2)
                );
            _backgroundRects =
                Parts.CreateRectangular(CleanRect.Size, CleanRect.Left, CleanRect.Top, Ui.Background.Size);
            _captionBackgroundRects = Parts.CreateHorizontal(_mBoxCaptionBarRect.Width,
                                                             Ui.CaptionBackground.Width, _mBoxCaptionBarRect.Top, _mBoxCaptionBarRect.Left, CaptionHeight);
            _buttonYes.X = _mBoxMainRect.Left + _mBoxMainRect.Width - _buttonYes.Width - _buttonNo.Width - (ButtonMargin * 3);
            _buttonYes.Y = _mBoxMainRect.Top + _mBoxMainRect.Height - ButtonHeight - BorderSize;
            _buttonNo.X  = _mBoxMainRect.Left + _mBoxMainRect.Width - _buttonNo.Width - (ButtonMargin * 2);
            _buttonNo.Y  = _mBoxMainRect.Top + _mBoxMainRect.Height - ButtonHeight - BorderSize;
            IsDirty      = false;
        }