private void toolStripColorPickerButton_Click(object sender, EventArgs e) { try { if (Program.CurrentImageType == 2) //Gray-scale Image { GrayScaleColorChoser ColorChoser = new GrayScaleColorChoser(); //Show the color choser window and obtain the color when user click ok if (ColorChoser.ShowDialog(this) == DialogResult.OK) { m_BrushColor = ColorChoser.Color; } } else if (Program.CurrentImageType == 3) //Color image { ColorDialog ColorChoser = new ColorDialog(); //Show the color choser window and obtain the color when user click ok if (ColorChoser.ShowDialog(this) == DialogResult.OK) { m_BrushColor = ColorChoser.Color; } } } catch (Exception exeption) { MessageBox.Show(exeption.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); AddLog("Error: " + exeption.Message); } }