コード例 #1
0
        public Unit(int pixels)
        {
            double units = Unit.ConvertToUnits((double)pixels, Unit.DefaultType);

            _value = units;
            _type  = Unit.DefaultType;
        }
コード例 #2
0
        public Unit ChangeType(UnitType type)
        {
            if (type == _type)
            {
                return(this);
            }

            return(new Unit(Unit.ConvertToUnits(Unit.ConvertToPixels(_value, _type), type), type));
        }
コード例 #3
0
 public Unit(double value, UnitType type)
 {
     _type  = type;
     _value = Unit.ConvertToUnits((double)value, type);
 }
コード例 #4
0
 public static Unit FromPixels(double pixels, UnitType type)
 {
     return(new Unit(Unit.ConvertToUnits(pixels, type), type));
 }