This question already has an answer here:
-
How to change menu hover color
4 answers
So I have a MenuStrip in C# which I am trying to do a darkish theme for, but when I press the button for the dropdown menu well....
Is there a way to make it go from white to another color? I can't seem to figure out a way to do it. This is probably my first time even customizing context menus.
You could use MouseHover
and MouseLeave
event. It's easy. Just do the following steps:
We have a form with these items: http://s3.picofile.com/file/8188577184/Capture.JPG
Choose that dark backcolor for ToolStripMenuItem. I choosed black
color for fileToolStripMenuItem
in my example.
Use this for MouseHover
event:
private void fileToolStripMenuItem_MouseHover(object sender, EventArgs e)
{
fileToolStripMenuItem.BackColor = Color.White;
fileToolStripMenuItem.ForeColor =Color.Black;
}
Use this for MouseLeave
event:
private void fileToolStripMenuItem_MouseLeave(object sender, EventArgs e)
{
fileToolStripMenuItem.BackColor = Color.Black;
fileToolStripMenuItem.ForeColor = Color.White;
}