コード例 #1
0
        public Form1()
        {
            InitializeComponent();

            var result = WinFormsHelper.ObjectToControls(b, new Size(100, 40), 20);

            result.Location = new Point(100, 100);
            result.Size     = new Size(300, 600);
            this.Controls.Add(result);

            bool i = false;

            var grid = WinFormsHelper.DrawGrid <Button>(5, 5, new Size(100, 100), (button) =>
            {
                i             = !i;
                bool localI   = i;
                button.Click += (o, a) => {
                    if (localI)
                    {
                        button.BackColor = Color.Red;
                    }
                    else
                    {
                        button.BackColor = Color.Blue;
                    }
                };
                var tag     = (int[])button.Tag;
                button.Text = "Column: " + tag[0] + "\n\r\t Row:" + tag[1];
            });

            grid.Location = new Point(500, 200);

            Controls.Add(grid);

            // Timer t = new Timer();
            //t.Tick += (s, a) => ((HardBass)b).Name = Guid.NewGuid().ToString();
            // t.Interval = 1500;
            //t.Start();
        }