C#桌面程序啓動時傳入參數

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;數組

namespace WindowsFormsApplication8
{
static class Program
{
/// <summary>
/// 應用程序的主入口點。
/// </summary>
[STAThread]
public static void Main(string[] args) //加參數,接收值,當經過拖拽文件啓動程序時,則參數數組的第一個值就是這個文件的路徑
{
if (args.Count()>0)
{
MessageBox.Show(args[0]);
}

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}spa

相關文章
相關標籤/搜索