[英]How do you open a file and view it in a FastColoredTextBox component in 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");
}
但它不起作用。 它引發異常:
“指定的可執行文件不是該操作系統平台的有效應用程序”
我想打開“你想如何打開這個文件”對話框,有或沒有適合該文件類型的標准應用程序。
使用ProcessStartInfo
的UseShellExecute
屬性。
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.