Guest User

Untitled

a guest
Jul 15th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  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 App
  11. {
  12. public partial class Form1 : Form
  13. {
  14. Button[,] buttons;
  15.  
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. }
  20.  
  21. private void Form1_Load(object sender, EventArgs e)
  22. {
  23. }
  24.  
  25. private void button1_Click(object sender, EventArgs e)
  26. {
  27. buttons = new Button[10, 10];
  28.  
  29. for (int i = 0; i < 9; i++)
  30. {
  31. for (int j = 0; j < 9; j++)
  32. {
  33. buttons[i, j] = new Button();
  34.  
  35. if (buttons[i, j].InvokeRequired)
  36. {
  37. buttons[i, j].Invoke(new MethodInvoker(
  38. delegate
  39. {
  40. buttons[i, j].Parent = panel1;
  41. }));
  42. }
  43. buttons[i, j].Size = new Size(10, 10);
  44. buttons[i, j].Location = new Point(i * 5, j * 5);
  45. buttons[i, j].Visible = true;
  46. buttons[i, j].Enabled = true;
  47. buttons[i, j].Text = ".......";
  48. }
  49. }
  50. }
  51. }
  52. }
Add Comment
Please, Sign In to add comment