简体   繁体   中英

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". Below is my code on how to open (.tif) file:

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. Below is my code on how to open (.txt) file:

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? Or provide some solution on how to fix this?

It sounds like either the path to mspview.exe or sample.TIF isn't valid. Can you specify the full path to mspview.exe and open Windows Explorer to verify the path to sample.TIF ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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