Table of Contents

Class CodeUnits

Namespace
RDCore.Forms.Model
Assembly
RDCore.Forms.dll

Conversions of a component's position and size between the pixels the model holds and the unit a program's code reads.

public static class CodeUnits
Inheritance
CodeUnits
Inherited Members

Remarks

In VB6, a control in a form or a PictureBox has its Left and Top as coordinates of its container's scale, its ScaleLeft and ScaleTop included, and its Width and Height as lengths in the scale's units. A length has no sign, even in a scale that runs right to left or bottom to top. A root's position and size are its client area's, in twips. These two rules were not measured with VB6: RDForms sets them.

Any other property is in the same unit for code as in the model: a scale's own properties and a Line's ends are in the container's scale already.

Methods

FromCode(ComponentInstance, PropertyDefinition, double, CodeUnit)

A position or a size a program's code writes, in pixels.

public static double FromCode(ComponentInstance component, PropertyDefinition property, double value, CodeUnit unit)

Parameters

component ComponentInstance

The component the property is of.

property PropertyDefinition

The property: Left, Top, Width or Height.

value double

The value, in the code's unit.

unit CodeUnit

The code's unit.

Returns

double

The value in pixels; value where property is no position or size.

Exceptions

ArgumentNullException

component or property is null.

IsExtent(PropertyDefinition)

Whether a property is a position or a size the model holds in pixels: Left, Top, Width or Height.

public static bool IsExtent(PropertyDefinition property)

Parameters

property PropertyDefinition

The property.

Returns

bool

true for one of the four.

ToCode(ComponentInstance, PropertyDefinition, double, CodeUnit)

A position or a size in pixels, as a program's code reads it.

public static double ToCode(ComponentInstance component, PropertyDefinition property, double pixels, CodeUnit unit)

Parameters

component ComponentInstance

The component the property is of.

property PropertyDefinition

The property: Left, Top, Width or Height.

pixels double

The value, in pixels.

unit CodeUnit

The code's unit.

Returns

double

The value in the code's unit; pixels where property is no position or size.

Exceptions

ArgumentNullException

component or property is null.