Table of Contents

Struct DrawingScale

Namespace
RDCore.Forms.Drawing
Assembly
RDCore.Forms.dll

A container's scale: how many twips one of its units is, across and down, and the coordinates of its inside's top left corner.

public readonly record struct DrawingScale : IEquatable<DrawingScale>
Implements
Inherited Members

Constructors

DrawingScale(double, double, double, double)

A container's scale: how many twips one of its units is, across and down, and the coordinates of its inside's top left corner.

public DrawingScale(double TwipsAcross, double TwipsDown, double Left, double Top)

Parameters

TwipsAcross double

The twips in one horizontal unit; negative where the scale runs right to left.

TwipsDown double

The twips in one vertical unit; negative where the scale runs bottom to top.

Left double

The coordinate of the inside's left edge, the container's ScaleLeft.

Top double

The coordinate of the inside's top edge, the container's ScaleTop.

Properties

Left

The coordinate of the inside's left edge, the container's ScaleLeft.

public double Left { get; init; }

Property Value

double

Top

The coordinate of the inside's top edge, the container's ScaleTop.

public double Top { get; init; }

Property Value

double

Twips

Twips from the inside's corner: the scale of a container that has none, such as a Frame.

public static DrawingScale Twips { get; }

Property Value

DrawingScale

TwipsAcross

The twips in one horizontal unit; negative where the scale runs right to left.

public double TwipsAcross { get; init; }

Property Value

double

TwipsDown

The twips in one vertical unit; negative where the scale runs bottom to top.

public double TwipsDown { get; init; }

Property Value

double

Methods

FromTwips(double, double)

Twips from the inside's corner as a point in the scale.

public (double X, double Y) FromTwips(double x, double y)

Parameters

x double

The twips across.

y double

The twips down.

Returns

(double Width, double Height)

The coordinates.

InsideOf(ComponentInstance)

A component's inside, in twips: its Width and Height, within its border where its BorderStyle draws one. A root's Width and Height are its inside already.

public static (double Width, double Height) InsideOf(ComponentInstance component)

Parameters

component ComponentInstance

The component.

Returns

(double Width, double Height)

The inside's width and height in twips, 0 where the component has no size.

Remarks

A border is a pixel wide where the component's Appearance is Flat, and two pixels wide where it is 3D.

Of(ComponentInstance?)

The scale of a container, over its inside as InsideOf(ComponentInstance) measures it.

public static DrawingScale Of(ComponentInstance? container)

Parameters

container ComponentInstance

The container, or null for none.

Returns

DrawingScale

The scale, as Of(ComponentInstance?, double, double) gives it.

Of(ComponentInstance?, double, double)

The scale of a container: its ScaleMode, ScaleLeft and ScaleTop, and for a user scale its ScaleWidth and ScaleHeight over its inside, in single precision as VB holds a scale.

public static DrawingScale Of(ComponentInstance? container, double insideWidth, double insideHeight)

Parameters

container ComponentInstance

The container, or null for none.

insideWidth double

The container's inside width, in twips: within its border, if it has one.

insideHeight double

The container's inside height, in twips.

Returns

DrawingScale

The scale. It is Twips for no container, for a container with no ScaleMode such as a Frame, and for a user scale whose ScaleWidth or ScaleHeight is 0.

ToTwips(double, double)

A point in the scale as twips from the inside's corner.

public (double X, double Y) ToTwips(double x, double y)

Parameters

x double

The horizontal coordinate.

y double

The vertical coordinate.

Returns

(double Width, double Height)

The twips across and down.