-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.cs
49 lines (46 loc) · 1.29 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Minesweeper
{
public partial class Form1 : Form
{
List<Button> btnList; //
public Form1()
{
InitializeComponent();
loadButtons();
}
private void loadButtons()
{
btnList = new List<Button>();
int w = panel1.Width / 9;
int h = panel1.Height / 9;
//Button btn = new Button();
//btn.Name = "btn1";
//btn.Size = new Size(w, h);
//btn.Location = new Point(15, 15);
//btnList.Add(btn);
////this.Controls.Add(btn);
//panel1.Controls.Add(btn);
for (int i = 0; i < 9; i++)
{
for (int j = 0; j < 9; j++)
{
Button btn = new Button();
btn.Name = "btn" + i.ToString();
btn.Size = new Size(w, h);
btn.Location = new Point(w * i, 5 + h * j);
btnList.Add(btn);
panel1.Controls.Add(btn);
}
}
}
}
}