Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9dcd9055d9 | ||
|
|
cc579d794e |
+20
-1
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
@@ -68,8 +68,27 @@ namespace MmdPdf
|
|||||||
// Startup
|
// Startup
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
|
// Windows reports whether we are being viewed over a remote desktop. In that case WPF's
|
||||||
|
// hardware compositing hands the session a surface it never repaints when the desktop is
|
||||||
|
// resized, which leaves the part of the window outside the original size drawn as flat
|
||||||
|
// black. Drawing in software costs nothing at this size and keeps the whole window painted.
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern int GetSystemMetrics(int index);
|
||||||
|
private const int SM_REMOTESESSION = 0x1000;
|
||||||
|
|
||||||
|
private static void UseSoftwareRenderingOnRemoteDesktops()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (GetSystemMetrics(SM_REMOTESESSION) != 0)
|
||||||
|
RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
|
||||||
|
}
|
||||||
|
catch { /* never let a rendering hint stop the application starting */ }
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
|
UseSoftwareRenderingOnRemoteDesktops();
|
||||||
StartupTrace.Mark("App.OnStartup entered");
|
StartupTrace.Mark("App.OnStartup entered");
|
||||||
DispatcherUnhandledException += OnDispatcherException;
|
DispatcherUnhandledException += OnDispatcherException;
|
||||||
AppDomain.CurrentDomain.UnhandledException += OnDomainException;
|
AppDomain.CurrentDomain.UnhandledException += OnDomainException;
|
||||||
|
|||||||
Reference in New Issue
Block a user