![](/img/trans.png)
[英]how to Run an winform application through window service when system goes idle
[英]Winform window gets shrinked when lauched through WPF Application
我创建了 WPF 应用程序。 在这个应用程序中
但是当我通过 4K 显示器 (3840 * 2100) 启动相同的东西时,表单大小会减小。
我尝试了以下事情。
任何帮助或建议都会有所帮助。 (仅供参考:当我尝试从 WinForms 启动相同的 exe 时,我没有看到这个问题)。
代码片段
/* mainwindow.xaml.cs*/
var procInfo = new System.Diagnostics.ProcessStartInfo(ExeName, arguments);
// Start the process
var ProcessObj = System.Diagnostics.Process.Start(procInfo);
var helper = new WindowInteropHelper(Window.GetWindow(this.grid1));
SetParent(ProcessHandler, helper.Handle);
/* App.manifest */
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
/*assemblyinfo.cs*/
[assembly: System.Windows.Media.DisableDpiAwareness]
使用以下任何解决方案使 WPF dpi 不可见:
/* App.manifest *
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</dpiAware>
</windowsSettings>
</application>
要么
/*assemblyinfo.cs*/
[assembly: System.Windows.Media.DisableDpiAwareness]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.