Clear Method

Summary
Clears the drawing area to the specified solid color brush.
Syntax
C#
C++/CLI
public void Clear( 
   SolidColorBrush brush 
) 
public: 
void Clear(  
   SolidColorBrush^ brush 
)  

Parameters

brush
The solid color brush to which the drawing area is cleared.

Remarks

If the rendering target has an active clip (specified by PushClip), the clear command is applied only to the area within the clipping region.

Example
C#
using Leadtools.Windows.D2DRendering; 
 
public void D2DSurfacePushLayerExample() 
{ 
   //Create a new instance of the D2DSurface object 
   D2DSurface d2dSurface = new D2DSurface(); 
 
   //Set the surface Size 
   d2dSurface.SurfaceSize = new Size(1000, 1000); 
 
   //Pass an empty rect to redraw the entire surface 
   d2dSurface.BeginDraw(Rect.Empty); 
 
   //Save the surface drawing state 
   D2DDrawingState drawingState = d2dSurface.Save(); 
 
   //Create an ellipse geometry 
   EllipseGeometry 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 operations  
   d2dSurface.PushLayer(geometryGroup); 
 
   //Create a rect having the specified dimensions 
   Rect rect = new Rect(40, 40, 500, 200); 
 
   //Create a new instance of a brush from a new solid color brush 
   SolidColorBrush fill = new SolidColorBrush(Colors.Green); 
 
   //Clear the pushed Layer with the fill brush 
   d2dSurface.Clear(fill); 
 
   //Stop redirecting drawing operations to the layer 
   d2dSurface.PopLayer(); 
 
   //Restore the surface drawing state 
   d2dSurface.Restore(drawingState); 
 
   //End the Draw operation and invalidate the surface 
   d2dSurface.EndDraw(); 
 
   d2dSurface.Invalidate(Rect.Empty); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.3.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Windows.D2DRendering Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.