Exemplo n.º 1
0
        static int DipsToPixels(
            float dips,
            float dpi,
            DpiRounding dpiRounding)
        {
            float scaled = dips * dpi / DEFAULT_DPI;

            switch (dpiRounding)
            {
            case DpiRounding.Floor: scaled = (float)Math.Floor(scaled); break;

            case DpiRounding.Round:
            default:
                scaled = (float)Math.Round(scaled); break;

            case DpiRounding.Ceiling: scaled = (float)Math.Ceiling(scaled); break;
            }

            return((int)(scaled));
        }
        static int DipsToPixels(
            float dips,
            float dpi,
            DpiRounding dpiRounding)
        {
            float scaled = dips * dpi / DEFAULT_DPI;
            switch (dpiRounding)
            {
                case DpiRounding.Floor: scaled = (float)Math.Floor(scaled); break;
                case DpiRounding.Round:
                default:
                    scaled = (float)Math.Round(scaled); break;
                case DpiRounding.Ceiling: scaled = (float)Math.Ceiling(scaled); break;
            }

            return (int)(scaled);
        }