private void new_button_Click(object sender, EventArgs e)
        {
            Button button = new Button();
            button.Location = new System.Drawing.Point(411, 334);
            button.Name = "my_button";
            button.Size = new Size(100, 100);
            button.TabIndex = 1;
            button.Text = "This is my new one.";
            button.UseVisualStyleBackColor = true;
            button.Visible = true;
        }

解决方案 »

  1.   

    加上:
    button.Parent = this;
      

  2.   


    我试了..还是不行...如下代码:
            private void new_button_Click(object sender, EventArgs e)
            {
                Button button = new Button();
                button.Location = new System.Drawing.Point(411, 334);
                button.Name = "my_button";
                button.Size = new Size(100, 100);
                button.TabIndex = 1;
                button.Text = "This is my new one.";
                button.UseVisualStyleBackColor = true;
                button.Visible = true;
                button.Parent = this;
                button.
            }
      

  3.   

    button.是多余的...刚刚忘记删除了反正加了button.Parent = this;还是不行
      

  4.   

    例如要放button的面板是form1
    form1.controls.add(button);
      

  5.   

    你只是把这个Button构造好了。
    你没有放到窗体上
    this.Controls.Add(button);
      

  6.   

    你的主窗口太小了,在构造函数中加上            Size = new System.Drawing.Size(550, 440);就OK了:
    using System;
    using System.Windows.Forms;class Program : Form
    {
           private void new_button_Click(object sender, EventArgs e)
            {
                Button button = new Button();
                button.Location = new System.Drawing.Point(411, 334);
                button.Name = "my_button";
                button.Size = new System.Drawing.Size(100, 100);
                button.TabIndex = 1;
                button.Text = "This is my new one.";
                button.UseVisualStyleBackColor = true;
                button.Parent = this;
            }
            
      Program()
      {
                Size = new System.Drawing.Size(550, 440);            Button button = new Button();
                button.Size = new System.Drawing.Size(100, 100);
                button.Text = "Click me";
                button.UseVisualStyleBackColor = true;
                button.Parent = this;
                button.Click += new EventHandler(new_button_Click);
      }
      
      // 程序入口
      static void Main()
      {
       Application.Run(new Program());
      }
    }
      

  7.   

    难道不用这样????
    this.Controls.Add(button);
      

  8.   


    button.Parent = this;和this.Controls.Add(button);是等效的,两者只要用一个就可以了。