private void panelSquareColor1_Click(object sender, EventArgs e) { SquareColorForm form = new SquareColorForm(); if (colorScheme.SquareTextures != null && colorScheme.SquareTextures.ContainsKey(0)) { form.Texture = colorScheme.SquareTextures[0]; } else { form.Color = colorScheme.SquareColors[0]; } if (form.ShowDialog() == DialogResult.OK) { if (form.Texture != null) { if (colorScheme.SquareTextures == null) { colorScheme.SquareTextures = new Dictionary <int, Texture>(); } colorScheme.SquareTextures[0] = form.Texture; colorScheme.SquareColors[0] = form.Texture.SubstituteColor; panelSquareColor1.BackgroundImage = form.Texture.Images[0]; } else { if (colorScheme.SquareTextures != null && colorScheme.SquareTextures.ContainsKey(0)) { colorScheme.SquareTextures.Remove(0); } colorScheme.SquareColors[0] = form.Color; panelSquareColor1.BackColor = colorDialog.Color; panelSquareColor1.BackgroundImage = null; } SchemeModified(); } }
private void panelSquareColor3_Click(object sender, EventArgs e) { SquareColorForm form = new SquareColorForm(); if (colorScheme.NumberOfColors < 3) { if (colorScheme.NumberOfColors < 2) { return; } form.NotUsedEnabled = true; form.NotUsed = true; } else { if (colorScheme.NumberOfColors > 3) { form.NotUsedEnabled = false; } else { form.NotUsedEnabled = true; } if (colorScheme.SquareTextures != null && colorScheme.SquareTextures.ContainsKey(2)) { form.Texture = colorScheme.SquareTextures[2]; } else { form.Color = colorScheme.SquareColors[2]; } } if (form.ShowDialog() == DialogResult.OK) { if (form.NotUsed) { colorScheme.NumberOfColors = 2; if (colorScheme.SquareColors.ContainsKey(2)) { colorScheme.SquareColors.Remove(2); } if (colorScheme.SquareTextures != null && colorScheme.SquareTextures.ContainsKey(2)) { colorScheme.SquareTextures.Remove(2); } panelSquareColor3.BackgroundImage = global::ChessV.GUI.Properties.Resources.RedX; } else { if (colorScheme.NumberOfColors == 2) { colorScheme.NumberOfColors = 3; } if (form.Texture != null) { if (colorScheme.SquareTextures == null) { colorScheme.SquareTextures = new Dictionary <int, Texture>(); } colorScheme.SquareTextures[2] = form.Texture; colorScheme.SquareColors[2] = form.Texture.SubstituteColor; panelSquareColor3.BackgroundImage = form.Texture.Images[0]; } else { if (colorScheme.SquareTextures != null && colorScheme.SquareTextures.ContainsKey(2)) { colorScheme.SquareTextures.Remove(2); } colorScheme.SquareColors[2] = form.Color; panelSquareColor3.BackColor = form.Color; panelSquareColor3.BackgroundImage = null; } } SchemeModified(); } }