public void Clear(SolidColorBrush brush)
brush
The solid color brush to which the drawing area is cleared.
If the rendering target has an active clip (specified by PushClip), the clear command is applied only to the area within the clipping region.
using Leadtools.Windows.D2DRendering;public void D2DSurfacePushLayerExample(){//Create a new instance of the D2DSurface objectD2DSurface d2dSurface = new D2DSurface();//Set the surface Sized2dSurface.SurfaceSize = new Size(1000, 1000);//Pass an empty rect to redraw the entire surfaced2dSurface.BeginDraw(Rect.Empty);//Save the surface drawing stateD2DDrawingState drawingState = d2dSurface.Save();//Create an ellipse geometryEllipseGeometry ellipse = new EllipseGeometry();ellipse.Center = new Point(500, 500);ellipse.RadiusX = 100;ellipse.RadiusY = 100;GeometryGroup geometryGroup = new GeometryGroup();geometryGroup.Children.Add(ellipse);//Push geometry to receive all subsequent drawing operationsd2dSurface.PushLayer(geometryGroup);//Create a rect having the specified dimensionsRect rect = new Rect(40, 40, 500, 200);//Create a new instance of a brush from a new solid color brushSolidColorBrush fill = new SolidColorBrush(Colors.Green);//Clear the pushed Layer with the fill brushd2dSurface.Clear(fill);//Stop redirecting drawing operations to the layerd2dSurface.PopLayer();//Restore the surface drawing stated2dSurface.Restore(drawingState);//End the Draw operation and invalidate the surfaced2dSurface.EndDraw();d2dSurface.Invalidate(Rect.Empty);}