日期:2014-05-18  浏览次数:20803 次

大哥大姐帮助一下,刚学c#,我在cmd下执行csc后生成了xx.exe双击打开后老出dos窗口呢
C# code

using System;
using System.Windows.Forms;
namespace we
{
/*==============主程序入口========================*/
    static class Program
    {
        [STAThread]
        static void Main()
        {
          Application.EnableVisualStyles();
          Application.SetCompatibleTextRenderingDefault(false);
          Application.Run(new Form1());
    Console.ReadKey();
        }
    }

    public partial class Form1 : Form
    {       
        public Form1()
        {
            InitializeComponent();
        }
    }

    
    partial class Form1
    {
        //主体变量名
        private System.ComponentModel.IContainer components = null;
        //按扭变量名
        private System.Windows.Forms.Button buttoww = new System.Windows.Forms.Button();        
        private void InitializeComponent()
        {
            buttoww.Location = new System.Drawing.Point(174, 205);
            buttoww.Name = "checkBox1";
            buttoww.Size = new System.Drawing.Size(75,23);
            buttoww.TabIndex = 1;
            buttoww.Text = "关上";
            buttoww.UseVisualStyleBackColor = true;
            buttoww.Click += new System.EventHandler(buttoww_Click);
            //窗体
            components = new System.ComponentModel.Container();
            Text = "我的第一个程序";
            //写入按扭
            Controls.Add(buttoww);
            
        }
        //按扭响应事件
        private void buttoww_Click(object sender, EventArgs e)
        {
          MessageBox.Show("还没有加数据");
        }
    }
}




大哥大姐帮助一下,刚学c#,我在cmd下执行csc后生成了xx.exe双击打开后老在程序窗口背面出一个dos窗口,我现在用的是记事本写,在vs2008里生成的xx.exe不会这样,请问在dos下怎么生成,不带dos窗口的xx.exe呢感谢.

------解决方案--------------------
加上参数/target:winexe
默认是/target:exe,生成的是控制台应用程序,会有个黑框。
------解决方案--------------------
探讨
加上参数/target:winexe
默认是/target:exe,生成的是控制台应用程序,会有个黑框。