fork download
  1. Button Button1;
  2. private void Form1_Load(object sender, EventArgs e) {
  3. //Buttonクラスのインスタンスを作成する
  4. this.Button1 = new System.Windows.Forms.Button();
  5.  
  6. //Buttonコントロールのプロパティを設定する
  7. this.Button1.Name = "Button1";
  8. this.Button1.Text = "押してね";
  9. //サイズと位置を設定する
  10. this.Button1.Location = new Point(10, 10);
  11. this.Button1.Size = new System.Drawing.Size(80, 20);
  12.  
  13. //フォームに追加する
  14. this.Controls.Add(this.Button1);
  15.  
  16. EventHandler click = null;
  17. click = (btnSender, btnE) => {
  18. Button btn1 = (Button)btnSender;
  19. Button btn2 = new Button();
  20.  
  21. btn2.Size = btn1.Size;
  22. btn2.Location = new Point(btn1.Location.X, btn1.Location.Y + btn1.Height);
  23. btn2.Click += new EventHandler(click);
  24. btn2.Parent = this;
  25. };
  26.  
  27. this.Button1.Click += click;
  28. }
  29.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,16): error CS0116: A namespace can only contain types and namespace declarations
prog.cs(2,22): error CS0116: A namespace can only contain types and namespace declarations
Compilation failed: 2 error(s), 0 warnings
stdout
Standard output is empty