Setting DPI Awareness of a new Process to display tiff

隐身守侯 提交于 2021-02-11 14:37:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!