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
TwipsAcrossdoubleThe twips in one horizontal unit; negative where the scale runs right to left.
TwipsDowndoubleThe twips in one vertical unit; negative where the scale runs bottom to top.
LeftdoubleThe coordinate of the inside's left edge, the container's
ScaleLeft.TopdoubleThe 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
Top
The coordinate of the inside's top edge, the container's ScaleTop.
public double Top { get; init; }
Property Value
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
TwipsAcross
The twips in one horizontal unit; negative where the scale runs right to left.
public double TwipsAcross { get; init; }
Property Value
TwipsDown
The twips in one vertical unit; negative where the scale runs bottom to top.
public double TwipsDown { get; init; }
Property Value
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
Returns
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
componentComponentInstanceThe 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
containerComponentInstanceThe 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
containerComponentInstanceThe container, or null for none.
insideWidthdoubleThe container's inside width, in twips: within its border, if it has one.
insideHeightdoubleThe container's inside height, in twips.
Returns
- DrawingScale
The scale. It is Twips for no container, for a container with no
ScaleModesuch as a Frame, and for a user scale whoseScaleWidthorScaleHeightis 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)