fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace WindowsFormsApplication1
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18. MyGroup g1 = new MyGroup();
  19. private void Form1_Load(object sender, EventArgs e)
  20. {
  21. for (int i = 0; i < 10; i++)
  22. {
  23. Button btn = new Button();
  24.  
  25. btn.Name = "hoge";
  26. btn.Location = new Point(10, i * 20);
  27. btn.Text = i.ToString();
  28.  
  29. this.Controls.Add(btn);
  30. this.g1.Controls.Add(btn);
  31. }
  32. g1.EnabledAll(false);
  33. }
  34. }
  35. public class MyGroup
  36. {
  37. public List<Control> Controls = new List<Control>();
  38. public void EnabledAll(bool b)
  39. {
  40. foreach (Control c in this.Controls)
  41. {
  42. c.Enabled = b;
  43. }
  44. }
  45. }
  46. }
  47.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty