问题
I want to display a tiff file using photoviewer.
private void StartProcessWithoutShell(string filePath)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
photoViewer.StartInfo = new ProcessStartInfo("rundll32.exe",
String.Format("\"{0}{1}\", ImageView_Fullscreen {2}",
Environment.Is64BitOperatingSystem ? path.Replace(" (x86)", "") : path,
@"\Windows Photo Viewer\PhotoViewer.dll",
filePath));
photoViewer.StartInfo.UseShellExecute = false;
photoViewer.Start();
}
Problem is that the image is blurry.When i open the file via double click it looks just fine. My guess is that i have to set the SetProcessDpiAwarenessContext to unaware but i do not know how in c#. I had another approach where i use ShellExecute, but there i am unable to kill the process because it retruns no processId.
Edit photoviewer is a process
photoViewer = new Process();
来源:https://stackoverflow.com/questions/64770389/setting-dpi-awareness-of-a-new-process-to-display-tiff