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

来源:互联网 发布:酷派5263手机网络设置 编辑:程序博客网 时间:2024/05/16 01:21
关键是在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());
        }

    }

}
 
原创粉丝点击