public static void Main() { Application.EnableVisualStyles(); WindowsUI windows = new WindowsUI(); windows.PlayGame(); }
public BoardForm(int i_BoardSize, WindowsUI i_WindowsUI) { FormBorderStyle = FormBorderStyle.FixedSingle; MaximizeBox = false; MinimizeBox = false; SizeGripStyle = SizeGripStyle.Hide; StartPosition = FormStartPosition.CenterScreen; ClientSize = new Size((i_BoardSize * k_ButtonSize) + 20, (i_BoardSize * k_ButtonSize) + 20); m_BoardButtons = new Button[i_BoardSize + 1, i_BoardSize + 1]; InitializeComponent(i_BoardSize, i_WindowsUI); }
public void InitializeComponent(int i_BoardSize, WindowsUI i_WindowsUI) { for (int i = 1; i <= i_BoardSize; i++) { for (int j = 1; j <= i_BoardSize; j++) { m_BoardButtons[i, j] = new Button(); m_BoardButtons[i, j].Left = ((j - 1) * k_ButtonSize) + 10; m_BoardButtons[i, j].Top = ((i - 1) * k_ButtonSize) + 10; m_BoardButtons[i, j].Size = new Size(k_ButtonSize, k_ButtonSize); m_BoardButtons[i, j].Visible = true; m_BoardButtons[i, j].Enabled = false; m_BoardButtons[i, j].UseVisualStyleBackColor = true; m_BoardButtons[i, j].Click += i_WindowsUI.BoardButtons_Click; Controls.Add(m_BoardButtons[i, j]); } } }