private void setColorStartPanelPreview(Button A, Button B) { A.Text = B.Text = "x"; setColorSection(A.BackColor, B.BackColor); previewBoard.setColorSection(A.BackColor, B.BackColor); previewBoard.refreshColorBoard(); }
private void btn_delete_Click(object sender, EventArgs e) { string namefile = dataGridViewLoadBoard.SelectedRows[0].Cells[1].Value.ToString(); // get namefile for delete. if (MessageBox.Show("You removing '" + namefile + "'. Are you sure?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (dataGridViewLoadBoard.RowCount > 0 && dataGridViewLoadBoard.SelectedRows.Count > 0) { string path = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\boardator\\" + namefile + ".xml"; File.Delete(path); if (dataGridViewLoadBoard.SelectedRows.Count > 0) { int remove = dataGridViewLoadBoard.SelectedRows[0].Index; dataGridViewLoadBoard.Rows.RemoveAt(remove); } // after delete. if (dataGridViewLoadBoard.RowCount > 0) // not empty save file. { dataGridViewLoadBoard.Rows[0].Selected = true; // row 0 selected , in start. dataGridViewLoadBoard_CellClick(dataGridViewLoadBoard, null); } else { previewBoard.setColorSection(Color.White, Color.White); previewBoard.refreshColorBoard(); previewBoard.clearPictureItemPreview(); } } } }