QUOTE(janne_panne @ 30 Jun, 2009 - 10:25 PM)

This is how I would do it:
CODE
int color = 1;
private void lblpcolor1_Click(object sender, EventArgs e)
{
// Convert event to MouseEventArgs so we can find out which mousebutton was clicked
MouseEventArgs me = (MouseEventArgs)e;
if (me.Button == MouseButtons.Left)
color++;
else if (me.Button == MouseButtons.Right)
color--;
if (color > 10)
color = 1;
else if (color < 1)
color = 10;
ChangeLabelColor(lblpcolor1);
}
private void ChangeLabelColor(Label lbl)
{
switch (color)
{
case 1:
lbl.BackColor = Color.Red;
break;
case 2:
lbl.BackColor = Color.Orange;
break;
case 3:
lbl.BackColor = Color.Yellow;
break;
case 4:
lbl.BackColor = Color.Green;
break;
case 5:
lbl.BackColor = Color.Cyan;
break;
case 6:
lbl.BackColor = Color.Blue;
break;
case 7:
lbl.BackColor = Color.Purple;
break;
case 8:
lbl.BackColor = Color.Black;
break;
case 9:
lbl.BackColor = Color.White;
break;
case 10:
lbl.BackColor = Color.Gray;
break;
}
}
I hope this helps you. Also don't hesitate to ask if there is anything confusing in my solution.
I've changed a bit to apply to my code, thanks a lot for the help.
Also I would like to ask if I use this "private void ChangeLabelColor(Label lbl)" can I apply it to other labels with the same function?