예제 #1
0
        /// <summary>
        /// DPIの変更
        /// </summary>
        /// <param name="dpi">DPI情報</param>
        private void    ChangeDpi(Dpi dpi)
        {
            if (!DpiHelperMethods.IsSupported)
            {
                return;
            }

            var elem = window.Content as FrameworkElement;

            if (elem != null)
            {
                elem.LayoutTransform = (dpi == this.systemDpi)
                                        ? Transform.Identity
                                        : new ScaleTransform((double)dpi.X / this.systemDpi.X, (double)dpi.Y / this.systemDpi.Y);
            }

            this.window.Width  = this.window.Width * dpi.X / this.currentDpi.X;
            this.window.Height = this.window.Height * dpi.Y / this.currentDpi.Y;

            Debug.WriteLine(string.Format("DPI Change: {0} -> {1} (System: {2})",
                                          this.currentDpi, dpi, this.systemDpi));

            this.currentDpi = dpi;
        }
예제 #2
0
 public bool    Equals(Dpi other)
 {
     return(this.X == other.X && this.Y == other.Y);
 }