Advertisement
thienlang

Button

Mar 17th, 2014
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. //Đặt thử t
  2.             int size = 25, row = 10, col = 10;
  3. /*****************************************************/
  4. //đoạn tạo button nek.
  5.             for (int i = 0; i < col; i++)
  6.             {
  7.                 for (int j = 0; j < row; j++)
  8.                 {
  9.                     Button cell = new Button();
  10.                     cell.Size = new Size(size, size);
  11.                     cell.Location = new Point(j * size, i * size+ 20);
  12.                     //cell.Text = i.ToString() + j.ToString();
  13.                     //cell.Click += Bam;
  14.                     this.Controls.Add(cell);
  15.                 }
  16.             }
  17.  
  18.  
  19. //hàm bấm.
  20. void Bam(object sender, EventArgs e)
  21.         {
  22.             Button btn = sender as Button;
  23.             MessageBox.Show(btn.Text);
  24.             btn.Enabled = false;
  25.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement