示例#1
0
        /// <summary>
        /// Convert between different units of screen resolutions.
        /// </summary>
        /// <param name="inputUnit"></param>
        /// <param name="inputValue"></param>
        /// <param name="outputUnit"></param>
        /// <returns></returns>
        public override double Convert(Itemkey inputUnit, double inputValue, Itemkey outputUnit)
        {
            switch (inputUnit)
            {
            case Itemkey.ScreenFontPoints:
                return(ScreenFontPoints.ToUnit(inputValue, outputUnit));

            case Itemkey.ScreenPercent:
                return(ScreenPercent.ToUnit(inputValue, outputUnit));

            default:
                throw new NotImplementedException(outputUnit.ToString());
            }
        }
示例#2
0
        /// <summary>
        /// Convert percentage unit based value into another unit based value.
        /// </summary>
        /// <param name="inputValue"></param>
        /// <param name="targetUnit"></param>
        /// <returns></returns>
        public static double ToUnit(double inputValue, Itemkey targetUnit)
        {
            ScreenPercent d = new ScreenPercent(inputValue);

            return(d.ToUnit(targetUnit));
        }