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
componentComponentInstanceThe component the property is of.
propertyPropertyDefinitionThe property:
Left,Top,WidthorHeight.valuedoubleThe value, in the code's unit.
unitCodeUnitThe code's unit.
Returns
- double
The value in pixels;
valuewherepropertyis no position or size.
Exceptions
- ArgumentNullException
componentorpropertyis 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
propertyPropertyDefinitionThe property.
Returns
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
componentComponentInstanceThe component the property is of.
propertyPropertyDefinitionThe property:
Left,Top,WidthorHeight.pixelsdoubleThe value, in pixels.
unitCodeUnitThe code's unit.
Returns
- double
The value in the code's unit;
pixelswherepropertyis no position or size.
Exceptions
- ArgumentNullException
componentorpropertyis null.