Table of Contents

Class AngleProperty

Namespace
CADability.UserInterface
Assembly
CADability.dll

Property entry for the control center that displays and edits an Angle, e.g. the start angle of an arc or the rotation of a text. The value is an Angle in radians, connected to its owner via the base class mechanisms of EditableProperty<T> (delegates, reflection or OnGetValue and OnSetValue); it is displayed and entered in degrees with the number of decimals of the "Formatting.Angle.Digits" setting (see also PreferNegativeValues). Its context menu ("MenuId.Angle") offers to modify the angle with the mouse (ModifyWithMouse), to define it by two points and to add or subtract 30°, 45°, 90° or 180°. An AngleHotSpot shows the entry as a draggable handle in the drawing area.

public class AngleProperty : EditableProperty<Angle>, IPropertyEntry, IShowProperty, IConstructProperty, ICommandHandler
Inheritance
AngleProperty
Implements
Inherited Members

Constructors

AngleProperty(IFrame, string)

Creates an angle property entry that is not yet connected to a value. Set OnGetValue and OnSetValue before the entry is used.

public AngleProperty(IFrame frame, string resourceId = null)

Parameters

frame IFrame

The frame whose formatting settings (digits, decimal separator) are used for the display

resourceId string

Resource id of the label text and the tooltip, or null

AngleProperty(GetValueDelegate, SetValueDelegate, IFrame, string)

Creates an angle property entry that reads and writes the value through the given delegates.

public AngleProperty(EditableProperty<Angle>.GetValueDelegate getValueDelegate, EditableProperty<Angle>.SetValueDelegate setValueDelegate, IFrame frame, string resourceId = null)

Parameters

getValueDelegate EditableProperty<Angle>.GetValueDelegate

Returns the current angle from the object that owns it

setValueDelegate EditableProperty<Angle>.SetValueDelegate

Transfers a new angle to the owning object

frame IFrame

The frame whose formatting settings are used for the display

resourceId string

Resource id of the label text and the tooltip, or null

AngleProperty(object, string, string, IFrame, bool)

Creates an angle property entry that reads and writes the value through reflection on a property of the owning object.

public AngleProperty(object ObjectWithAngle, string PropertyName, string resourceId, IFrame frame, bool autoModifyWithMouse = true)

Parameters

ObjectWithAngle object

The object that owns the value, e.g. an arc or a text

PropertyName string

Name of a (public or non-public) instance property of type Angle on ObjectWithAngle

resourceId string

Resource id of the label text and the tooltip

frame IFrame

The frame whose formatting settings are used for the display

autoModifyWithMouse bool

Not evaluated by this constructor; kept for compatibility with older code

AngleProperty(string, IFrame, bool)

Obsolete: creates the entry like AngleProperty(IFrame, string); autoModifyWithMouse is ignored.

[Obsolete("Parameter autoModifyWithMouse no longer supported, use AngleProperty(IFrame frame, string resourceId) instead")]
public AngleProperty(string resourceId, IFrame frame, bool autoModifyWithMouse)

Parameters

resourceId string

Resource id of the label text and the tooltip

frame IFrame

The frame whose formatting settings are used for the display

autoModifyWithMouse bool

Ignored

Properties

PreferNegativeValues

When true, angles greater than 180° are displayed as negative angles (the value minus 360°), e.g. 270° is shown as -90°. The stored value is not changed. Default is false, i.e. the display is in the range from 0° to 360°.

public bool PreferNegativeValues { get; set; }

Property Value

bool

Methods

AngleChanged()

Must be called by the owner when the angle has been changed from outside (not through this entry), so that the displayed value is refreshed. Has no effect while the entry is not on a property page.

public void AngleChanged()

CheckMouseButton(bool)

Obsolete and without functionality; the call can be removed.

[Obsolete("method has no functionality, remove this call")]
public void CheckMouseButton(bool Check)

Parameters

Check bool

Ignored

GetAngle()

Returns the current angle as read from the owning object (or the value held by this entry when no object is connected).

public double GetAngle()

Returns

double

The angle in radians

SetAngle(double)

Sets the angle: transfers it to the owning object (through the set delegate or the reflected property) and refreshes the display. Used by the owner, by the context menu commands and by actions that construct the angle.

public void SetAngle(double l)

Parameters

l double

The new angle in radians

TextToValue(string, out Angle)

Converts the text to a value. Returns true if possible, false otherwise (maybe invalid characters or outside the limit)

protected override bool TextToValue(string text, out Angle val)

Parameters

text string
val Angle

Returns

bool

ValueToText(Angle)

Returns the text representation of the value.

protected override string ValueToText(Angle val)

Parameters

val Angle

Returns

string

Events

GetAngleEvent

Obsolete: adding a handler installs it as OnGetValue, so it is asked for the current value whenever the entry needs it. Only one handler is kept (adding replaces the previous one), removing clears the delegate.

[Obsolete("use delegate AngleProperty.OnGetValue instead")]
public event AngleProperty.GetAngleDelegate GetAngleEvent

Event Type

AngleProperty.GetAngleDelegate

LabelChangedEvent

Obsolete and never raised; use LabelTextChanged instead.

[Obsolete("use delegate AngleProperty.LabelTextChanged instead")]
public event AngleProperty.LabelChangedDelegate LabelChangedEvent

Event Type

AngleProperty.LabelChangedDelegate

LockedChangedEvent

Obsolete: adding a handler installs it as LockedChanged, which is called with the new state whenever Locked changes. Only one handler is kept, removing clears the delegate.

[Obsolete("use delegate AngleProperty.LockedChanged instead")]
public event EditableProperty<Angle>.LockedChangedDelegate LockedChangedEvent

Event Type

EditableProperty<Angle>.LockedChangedDelegate

ModifyWithMouseEvent

Obsolete: adding a handler installs it as ModifyWithMouse. The handler is called with true when the user starts dragging the hotspot of this entry and with false when the "modify with mouse" command of the context menu is selected. Only one handler is kept, removing clears the delegate.

[Obsolete("use delegate AngleProperty.ModifyWithMouse instead")]
public event ModifyWithMouseDelegate ModifyWithMouseEvent

Event Type

ModifyWithMouseDelegate

SetAngleEvent

Obsolete: adding a handler installs it as OnSetValue, so it is called whenever a new value is to be transferred to the owner. Only one handler is kept (adding replaces the previous one), removing clears the delegate.

[Obsolete("use delegate AngleProperty.OnSetValue instead")]
public event AngleProperty.SetAngleDelegate SetAngleEvent

Event Type

AngleProperty.SetAngleDelegate