winform运行时如何接受参数?(示例)

关键是在Main函数中处理,示例如下

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace WinFormTest
{
    
static class Program
    
{
        
/// <summary>
        
/// 应用程序的主入口点。
        
/// </summary>

        [STAThread]
        
static void Main(string[] args)
        
{
            
foreach (string p in args)
            
{
                MessageBox.Show(
"p=" + p);
            }

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

    }

}
作者:菩提树下的杨过
出处:http://yjmyzz.cnblogs.com
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/yjmyzz/p/1057536.html