C# 直接用进程打开文件(文本文件,图片等)

/// <summary>
/// 文件查看
/// </summary>
private void DataFileView(string filePath)
{
    if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath))
    {
        return;
    }

    ProcessStartInfo psi = new ProcessStartInfo();
    psi.FileName = filePath;
    psi.UseShellExecute = true;

    Process.Start(psi);
}

猜你喜欢

转载自blog.csdn.net/qq_35106907/article/details/86222527