private void PushRectangleClip(IGraphicsTarget graphicsTarget, RectangleF rect)
{
object rectanglePath = new object();
graphicsTarget.CreatePath(rectanglePath, new List<GraphicsPathPart>() {
new GraphicsPathPart(GraphicsPathPartKind.Start, new PointF[] { rect.Location }),
new GraphicsPathPart(GraphicsPathPartKind.Lines, new PointF[] { new PointF(rect.Right, rect.Top), new PointF(rect.Right, rect.Bottom), new PointF(rect.Left, rect.Bottom), new PointF(rect.Left, rect.Top)}),
new GraphicsPathPart(GraphicsPathPartKind.Close, new PointF[0])
}, FillMode.Winding);
graphicsTarget.PushClip(rectanglePath);
}