예제 #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);
            }
        }
예제 #2
0
        public Top_Level_Forms()
        {
            InitializeComponent();

            // Hook up DPIChanged event
            // this.Parent.dpi += new System.Windows.Forms.DpiChangedEventHandler();

            cboDpiContext.DataSource      = DpiAwarenessContexts;
            cboHostingBehavior.DataSource = DpiHostingBehaviors;

            // Fill template combo
            Type formType = typeof(UserControl);

            foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (formType.IsAssignableFrom(type))
                {
                    cboTemplate.Items.Add(type.Name);
                }
            }

            // Set cbo defaults
            cboTemplate.Text = this.Name;

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

            cboHostingBehavior.Text =
                DPIHelper.GetThreadDpiHostingBehavior().ToString();
        }