if (colorDialog1.ShowDialog () == DialogResult.OK) {
button2.BackColor = colorDialog1.Color; }
What type and how to assign a variable to the color selected in ColorDialog, then to use for the brush color (which is drawn using small ellipses).
if (colorDialog1.ShowDialog () == DialogResult.OK) {
button2.BackColor = colorDialog1.Color; }
What type and how to assign a variable to the color selected in ColorDialog, then to use for the brush color (which is drawn using small ellipses).
The color of the brush is set when it is created (passed to the constructor). If you need to change the color of the brush, destroy the old one ( Dispose()
) and create a new one by passing a new color to the constructor.
private void button1_Click(object sender, System.EventArgs e) { ColorDialog MyDialog = new ColorDialog(); //Меняет цвет текста в текстбоксе if (MyDialog.ShowDialog() == DialogResult.OK) textBox1.ForeColor = MyDialog.Color; }
I think this is what you need. Try using this method. Based on this, the brush can be assigned the value MyDialog.Color.
Source: https://ru.stackoverflow.com/questions/195828/
All Articles