简体   繁体   English

如何使用System.Diagnostics打开(.tif)文件

[英]How to open (.tif) file using System.Diagnostics

I have problem during opening a (.tif) file it throws an exeption "The system cannot find the file specified". 我在打开(.tif)文件时遇到问题,它抛出异常“系统找不到指定的文件”。 Below is my code on how to open (.tif) file: 以下是有关如何打开(.tif)文件的代码:

try
{
    ProcessStartInfo p = new ProcessStartInfo();
    p.FileName = "MSPVIEW.exe";
    p.Arguments = @"C:\New folder\sample.TIF";
    p.UseShellExecute = false;
    p.ErrorDialog = false;
    p.RedirectStandardOutput = true;
    p.WindowStyle = ProcessWindowStyle.Maximized;
    Process.Start(p);
}
catch (Exception ex)
{

    MessageBox.Show(ex.Message);
}

But when I'm going to open a (.txt) file there's no problem with it. 但是,当我要打开(.txt)文件时,它没有问题。 Below is my code on how to open (.txt) file: 以下是有关如何打开(.txt)文件的代码:

try
{

    ProcessStartInfo p = new ProcessStartInfo();
    p.FileName = "notepad.exe";
    p.Arguments = @"C:\New folder\NewTextFile.txt";
    p.UseShellExecute = false;
    p.ErrorDialog = false;
    p.RedirectStandardOutput = true;
    p.WindowStyle = ProcessWindowStyle.Maximized;
    Process.Start(p);
}
catch (Exception ex)
{

    MessageBox.Show(ex.Message);
}

Is there anybody have the same issue of opening of (.TIF) file? 是否有打开(.TIF)文件的相同问题? Or provide some solution on how to fix this? 或提供有关如何解决此问题的解决方案?

It sounds like either the path to mspview.exe or sample.TIF isn't valid. 这听起来像一个路径, mspview.exesample.TIF无效。 Can you specify the full path to mspview.exe and open Windows Explorer to verify the path to sample.TIF ? 您可以指定的完整路径mspview.exe ,打开Windows资源管理器来验证路径sample.TIF

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM