public Unit(int pixels) { double units = Unit.ConvertToUnits((double)pixels, Unit.DefaultType); _value = units; _type = Unit.DefaultType; }
public Unit ChangeType(UnitType type) { if (type == _type) { return(this); } return(new Unit(Unit.ConvertToUnits(Unit.ConvertToPixels(_value, _type), type), type)); }
public Unit(double value, UnitType type) { _type = type; _value = Unit.ConvertToUnits((double)value, type); }
public static Unit FromPixels(double pixels, UnitType type) { return(new Unit(Unit.ConvertToUnits(pixels, type), type)); }