private void DrawShape(Rectangle rect, IBrush brush, Pen pen, Action <Gdi.Brush, Gdi.Rectangle> fillShapeAction, Action <Gdi.Pen, Gdi.Rectangle> outlineShapeAction)
        {
            var minSize   = Size.Min(this.Size, rect.Size);
            var rectangle = new Rectangle(rect.Position, minSize);

            if (Validate(brush))
            {
                using var gdiBrush = brush.ToGdi(rectangle);
                fillShapeAction(gdiBrush, rectangle.ToGdi());
            }

            if (Validate(pen))
            {
                using var gdiPen = pen.ToGdi(rectangle);
                outlineShapeAction(gdiPen, rectangle.ToGdi());
            }
        }