示例#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 a font size to other values.
        /// </summary>
        /// <param name="inputValue"></param>
        /// <param name="targetUnit"></param>
        /// <returns></returns>
        public static double ToUnit(double inputValue, Itemkey targetUnit)
        {
            ScreenFontPoints d = new ScreenFontPoints(inputValue);

            return(d.ToUnit(targetUnit));
        }