예제 #1
0
        private void RefreshValues()
        {
            if (!this.Visible || this.Disposing)
            {
                return;
            }

            IntPtr hWndHost         = Process.GetCurrentProcess().MainWindowHandle;
            IntPtr hWndTaskpane     = this.Handle;
            IntPtr hWndContainer    = DPIHelper.FindParentWithClassName(hWndTaskpane, "MsoCommandBar");
            IntPtr hWndTaskpaneHost = DPIHelper.FindParentWithClassName(hWndTaskpane, "CMMOcxHostChildWindowMixedMode");

            this.txtThreadAwareness.Text  = DPIHelper.GetThreadDpiAwareness().ToString();
            this.txtProcessAwareness.Text = DPIHelper.GetProcessDpi().ToString();

            if (this.Handle != null)
            {
                this.txtTaskpaneWindowAwareness.Text =
                    DPIHelper.GetWindowDpiAwarenessContext(this.Handle).ToString();
            }

            this.txtHostWindowAwareness.Text =
                DPIHelper.GetWindowDpiAwarenessContext(hWndHost).ToString();

            this.txtChildWindowMixedMode.Text =
                DPIHelper.GetThreadDpiHostingBehavior(hWndTaskpaneHost).ToString();

            this.txtTaskpaneRect.Text  = HwndInfoString(hWndTaskpane);
            this.txtContainerRect.Text = HwndInfoString(hWndContainer);

            if (m_customTaskPane != null)
            {
                this.txtGetWidthHeight.Text = string.Format("{0}, {1}", m_customTaskPane.Width, m_customTaskPane.Height);
            }
        }