SKCanvasView.OnPaintSurface(SKPaintSurfaceEventArgs) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Implement this to draw on the canvas.
protected virtual void OnPaintSurface (SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs e);
Parameters
The event arguments that contain the drawing surface and information.
Examples
protected override void OnPaintSurface (SKPaintSurfaceEventArgs e)
{
// call the base method
base.OnPaintSurface (e);
var surface = e.Surface;
var surfaceWidth = e.Info.Width;
var surfaceHeight = e.Info.Height;
var canvas = surface.Canvas;
// draw on the canvas
canvas.Flush ();
}
Remarks
There are two ways to draw on this surface: by overriding the OnPaintSurface(SKPaintSurfaceEventArgs) method, or by attaching a handler to the PaintSurface event.
Important
If this method is overridden, then the base must be called, otherwise the event will not be fired.
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.