Пример #1
0
 internal abstract void Draw(DrawHelper helper, Vector2 offset);
Пример #2
0
        internal override void Draw(DrawHelper helper, Vector2 offset)
        {
            if (!IsVisible)
            {
                return;
            }

            var topLeftOffset     = Vector2.Zero;
            var topRightOffset    = Vector2.Zero;
            var bottomLeftOffset  = Vector2.Zero;
            var bottomRightOffset = Vector2.Zero;

            if (!string.IsNullOrEmpty(WinTopLeftTexture))
            {
                topLeftOffset = helper.DrawTextureWithOffset(Location, WinTopLeftTexture);
            }
            if (!string.IsNullOrEmpty(WinTopRightTexture))
            {
                topRightOffset = helper.DrawTextureWithOffset(Location + new Vector2(Size.X, 0), WinTopRightTexture, DrawHelper.AlignOffset.TopRight);
            }
            if (!string.IsNullOrEmpty(WinBottomLeftTexture))
            {
                bottomLeftOffset = helper.DrawTextureWithOffset(Location + new Vector2(0, Size.Y), WinBottomLeftTexture, DrawHelper.AlignOffset.BottomLeft);
            }
            if (!string.IsNullOrEmpty(WinBottomRightTexture))
            {
                bottomRightOffset = helper.DrawTextureWithOffset(Location + new Vector2(Size.X, Size.Y), WinBottomRightTexture, DrawHelper.AlignOffset.BottomRight);
            }

            //Top
            if (!string.IsNullOrEmpty(WinTopTexture))
            {
                helper.DrawTextureRepeat(Location + new Vector2(topLeftOffset.X, 0),
                                         Location + new Vector2(Size.X - topRightOffset.X, topLeftOffset.Y), WinTopTexture);
            }
            //Bottom
            if (!string.IsNullOrEmpty(WinBottomTexture))
            {
                helper.DrawTextureRepeat(Location + new Vector2(topLeftOffset.X, Size.Y - bottomLeftOffset.Y),
                                         Location + new Vector2(Size.X - topRightOffset.X, Size.Y), WinBottomTexture);
            }
            //Left
            if (!string.IsNullOrEmpty(WinLeftTexture))
            {
                helper.DrawTextureRepeat(Location + new Vector2(0, topLeftOffset.Y),
                                         Location + new Vector2(topLeftOffset.X, Size.Y - bottomLeftOffset.Y), WinLeftTexture);
            }
            //Right
            if (!string.IsNullOrEmpty(WinRightTexture))
            {
                helper.DrawTextureRepeat(Location + new Vector2(Size.X - topRightOffset.X, topLeftOffset.Y),
                                         Location + new Vector2(Size.X, Size.Y - bottomLeftOffset.Y), WinRightTexture);
            }


            //Fill
            var rectangle = new Rectangle((int)(Location.X + topLeftOffset.X), (int)(Location.Y + topLeftOffset.Y),
                                          (int)(Size.X - topLeftOffset.X - topRightOffset.X), (int)(Size.Y - topLeftOffset.Y - bottomLeftOffset.Y));

            helper.DrawRectangle(rectangle, BackgroundColor);

            helper.DrawString(this, Location + new Vector2(10, 6), Title, Color.White);

            foreach (var control in Controls)
            {
                if (control.IsVisible)
                {
                    control.Draw(helper, Location);
                }
            }
        }