簡體   English   中英

如何在 c# 中打開“你想如何打開這個文件”對話框?

[英]how to open "how do you want to open this file" dialog in c#?

我想為 c# 中的文件打開以下對話框

文件對話框

一些帖子建議 Process.Start

    private void button1_Click(object sender, EventArgs e)
    {
        Process.Start(@"d:\1.abc");
    }

但它不起作用。 它引發異常:

“指定的可執行文件不是該操作系統平台的有效應用程序”

我想打開“你想如何打開這個文件”對話框,有或沒有適合該文件類型的標准應用程序。

使用ProcessStartInfoUseShellExecute屬性。

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = @"C:\path\to\file.txt";
startInfo.UseShellExecute = true;
Process.Start(startInfo);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM