共用方式為


SKCanvasView.PaintSurface 事件

定義

發生于需要重新繪製畫布時。

public event EventHandler<SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs> PaintSurface;
public event EventHandler<SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs>? PaintSurface;

事件類型

範例

myView.PaintSurface += (sender, 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 ();
};

備註

在此介面上繪製的方式有兩種:藉由覆寫 OnPaintSurface(SKPaintSurfaceEventArgs) 方法,或將處理常式附加至 PaintSurface 事件。

適用於