Table of Contents

Method DrawFocusRect

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

DrawFocusRect(SKCanvas, SKRect, SKColor, float, float, float, float, bool, bool)

Draws a focus-like dashed rectangle (similar to WinForms DrawFocusRectangle). Uses CreateFocusRectPaint internally.

public static void DrawFocusRect(SKCanvas canvas, SKRect rect, SKColor color, float strokeWidth = 1, float dashOn = 1, float gap = 1, float phase = 0, bool useXorBlend = true, bool antialiasing = false)

Parameters

canvas SKCanvas

Target canvas (must not be null).

rect SKRect

Rectangle in canvas coordinates.

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.

DrawFocusRect(SKCanvas, SKRect, SKColor)

Draws a focus rectangle on the specified canvas using the given color. FocusRectPaint is used to draw the rectangle.

public static void DrawFocusRect(SKCanvas canvas, SKRect rect, SKColor color)

Parameters

canvas SKCanvas

The SKCanvas on which the focus rectangle will be drawn. Cannot be null.

rect SKRect

The SKRect defining the bounds of the focus rectangle.

color SKColor

The SKColor to use for the focus rectangle.