I would like to change the colour of the label box - not just the text within the label. How would i do this?
label.BackColor = Color.Coral;
(for instance) will change the colour of the text within the label.. rather than the background colour of the entire label box.
Also, if it matters, i'm using a toolStripContainer and ToolStrip. I used ToolStrip to create a label.... (i've used ForeColor in my code because using "BackColor" results in no change what so ever. Using ForeColor at least changes the colour of the font)
private void labelEdit_MouseHover(object sender, EventArgs e)
{
labelEdit.ForeColor = Color.Coral;
}
EDIT: It turns out the question is a bit of a red herring. Changing the ForeColor
changes the text appropriately, but changing the BackColor
does nothing, apparently.
EDIT: As per comments, it looks like you need to set ToolStrip.RenderMode
to ToolStripRenderMode.System
on your tool strip.
Now you've posted the actual code, the answer is obvious. You originally said you were using:
label.BackColour = Color.Coral;
You're actually using:
labelFile.ForeColor = Color.Coral;
Note "Fore" vs "Back". You wish to change the background colour... so you should be using
labelFile.BackColor = Color.Coral;
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