Table of Contents

Method CreateFocusRectPaint

Namespace
Alternet.Skia
Assembly
Alternet.UI.Common.dll

CreateFocusRectPaint(SKColor, float, float, float, float, bool, bool, SKStrokeCap)

Creates an SKPaint configured to draw a focus-like dashed rectangle (similar to WinForms DrawFocusRectangle). The returned SKPaint must be disposed by the caller.

public static SKPaint CreateFocusRectPaint(SKColor color, float strokeWidth = 1, float dashOn = 1, float gap = 1, float phase = 0, bool useXorBlend = true, bool antialiasing = false, SKStrokeCap strokeCap = SKStrokeCap.Square)

Parameters

color SKColor

Primary color used for the stroke (when xor==true, result depends on blend and background).

strokeWidth float

Stroke width in canvas units (use 1 for a typical hairline).

dashOn float

Dash "on" length (small value produces dot-like strokes, e.g. 1).

gap float

Dash "off" length (space between dots).

phase float

Dash phase offset (use to create marching-ants animation).

useXorBlend bool

If true, sets paint.BlendMode = SKBlendMode.Xor to try to mimic GDI+ XOR drawing (backend dependent).

antialiasing bool

Whether to enable antialiasing for the paint.

strokeCap SKStrokeCap

Stroke cap to use. Round produces rounded dots for short on-lengths; Square produces rectangular dashes.

Returns

SKPaint

An SKPaint instance configured for focus-rect drawing. Caller must dispose it.