0
我正在制作Outlook插件,并试图将窗口置于Outlook的中心。 为了实现这一点,我以前执行以下操作:从Outlook应用程序获取DPI
Outlook.Application olApp;
...
dynamic activeWindow = olApp.ActiveWindow();
wpf_ui_control.Left = activeWindow.Left + (activeWindow.Width/2) - (wpf_ui_control.Width/2);
wpf_ui_control.Top = activeWindow.Top + (activeWindow.Height/2) - (wpf_ui_control.Height/2);
此当然,实践证明当无用DPI不是100%。
我见过几个例子,从不同的控件获取DPI,但没有一个从outlook.explorer \ outlook.Inspect(.ActiveWindow()的结果)。
在这种情况下,我将如何着手获取DPI或计算中心?
感谢
你见过吗? http://stackoverflow.com/questions/1918877/how-can-i-get-the-dpi-in-wpf –
我实际上取消了第一个答案,因为实际上还没有一个可见的控制,但还有另一个解决方案正是为了这个场合。要检查出来! – RanH
谢谢@SimonMourier这个解决方案确实帮助我! – RanH