Table of Contents

Class Knob

Namespace
PluginUI
Assembly
PluginUI.dll

Rotary control. Drag up/right to increase (Shift = fine), wheel and arrow keys step, double-click or Ctrl+click resets, Alt+click (or right double-click) types a value. Vector styles: KnobStyle; bitmap/SVG looks through Skin (FilmStripSkin, SvgRotarySkin).

public class Knob : ValueControl
Inheritance
Knob
Inherited Members

Examples

Bound to a parameter, with the classic vector look, then with a film strip skin (128 frames stacked vertically):

var cutoff = new Knob(Parameters[model.Cutoff]) { Label = "CUTOFF", KnobStyle = KnobStyle.Classic, ShowValueBubble = true };
var drive = new Knob(Parameters[model.Drive])
{
    Label = "DRIVE",
    // Resource embedded with LogicalName="assets/knob.png" (as in projects generated by PluginUIEditor).
    Skin = new FilmStripSkin(new FilmStrip(ImageSource.FromResource(typeof(MyEditor).Assembly, "assets/knob.png"), 128, Orientation.Vertical)),
};

Constructors

Knob()

Creates a knob.

public Knob()

Knob(IParameter)

Creates a knob bound to a parameter.

public Knob(IParameter parameter)

Parameters

parameter IParameter

Properties

AllowTextEntry

Allows typing the value in a text box (default true). The actions that open it are chosen by TextEntryTriggers: by default a double-click on the value text, Alt+click, a right double-click or Enter.

public bool AllowTextEntry { get; set; }

Property Value

bool

BipolarCenter

Origin of the bipolar arc (normalized).

public double BipolarCenter { get; set; }

Property Value

double

DefaultSize

Natural size used when no explicit size is given.

protected override Size DefaultSize { get; }

Property Value

Size

DragDirection

Mouse axis driving the drag.

public DragDirection DragDirection { get; set; }

Property Value

DragDirection

IsBipolar

Draws the value arc from BipolarCenter (pan, balance, ± gain).

public bool IsBipolar { get; set; }

Property Value

bool

KnobStyle

Vector look.

public KnobStyle KnobStyle { get; set; }

Property Value

KnobStyle

MaxAngle

Angle at value 1.

public float MaxAngle { get; set; }

Property Value

float

MinAngle

Angle at value 0 (degrees, clockwise from 12 o'clock).

public float MinAngle { get; set; }

Property Value

float

ModulationAmount

Signed modulation depth (normalized, −1..1) drawn as a second arc from the value: shows LFO/envelope modulation without changing the value. 0 hides it.

public double ModulationAmount { get; set; }

Property Value

double

ModulationColor

Color of the modulation arc (null = palette alternate accent).

public Color? ModulationColor { get; set; }

Property Value

Color?

Parser

Text → normalized value parser for typed values (default: parameter parser, or percent).

[Browsable(false)]
public Func<string, double?>? Parser { get; set; }

Property Value

Func<string, double?>

SupportsTextEntry

true if this control can open a text box to type its value (see BeginTextEntry()).

protected override bool SupportsTextEntry { get; }

Property Value

bool

TickCount

Number of tick marks around the knob (0 = none; Classic defaults to 11).

public int TickCount { get; set; }

Property Value

int

Methods

AngleOf(double)

Angle (degrees) of a normalized value.

public float AngleOf(double normalized)

Parameters

normalized double

Returns

float

BeginTextEntry()

Opens the in-place text box over the value text (or over the knob when the value is hidden).

public override void BeginTextEntry()

OnMouseDown(MouseEventArgs)

Mouse button pressed over the element (or captured).

protected override void OnMouseDown(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseMove(MouseEventArgs)

Mouse moved over the element (or captured).

protected override void OnMouseMove(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseUp(MouseEventArgs)

Mouse button released.

protected override void OnMouseUp(MouseEventArgs e)

Parameters

e MouseEventArgs

RenderVector(DrawingContext, Rect, VectorStyle)

Vector rendering of the widget area.

protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)

Parameters

dc DrawingContext
widget Rect
style VectorStyle