This is the code I have so far:
private void btnColour_Click(object sender, EventArgs e)
{
//show the colour dialog and check that user clicked ok
if (clrDialog.ShowDialog() == DialogResult.OK)
{
//save the colour that the user chose
c = clrDialog.Color;
}
}
Color c = Color.Black;
Isn't it supposed to be working? maybe I have selected the wrong event?
You should create the Dialog in the event handler instead of outside, try something like this:
private void btnColour_Click(object sender, EventArgs e)
{
ColorDialog clrDialog = new ColorDialog();
//show the colour dialog and check that user clicked ok
if (clrDialog.ShowDialog() == DialogResult.OK)
{
//save the colour that the user chose
c = clrDialog.Color;
}
}
Color c = Color.Black;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With