【问题标题】:C# Opening Images with default viewer - Not possible to navigate through more imagesC# 使用默认查看器打开图像 - 无法浏览更多图像
【发布时间】:2023-01-04 22:29:18
【问题描述】:

当我尝试使用默认图片查看器打开图像时,它只会加载目标图像。这是一个问题,因为无法导航/浏览目录中的其他图像。

这是我打开图像的方式:

Process.Start("explorer.exe", ImagePathString);

也许我需要直接使用默认查看器启动它而无需资源管理器处理它。但我不知道如何解析它。我试过this,但是没有用。 我得到一个 System.InvalidOperationException,因为它找不到正确的可执行文件。

System.InvalidOperationException: '无法启动进程,因为一个文件 没有提供名字。

有没有办法从一个目录加载所有图像,或者只启用向前和向后导航的功能?

【问题讨论】:

    标签: c# .net image .net-core process


    【解决方案1】:

    您必须将 executable file of picture viewer 作为 FileName 参数提供给流程:

    Process photoViewer = new Process();
    
    //executable file of picture viewer
    photoViewer.StartInfo.FileName = @"F:Google.PicasaPicasa3Picasa3.exe";
    photoViewer.StartInfo.Arguments =ImagePathString;
    photoViewer.Start();
    

    【讨论】:

    • 这有点帮助。遗憾的是,您不能只针对 Windows 照片查看器或从 MS 下载的其他应用程序。它确实适用于 Picasa
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-21
    • 1970-01-01
    相关资源
    最近更新 更多