您可以使用渲染模式,但这只会将系统主题设置为默认值。.net 允许您更改背景颜色和颜色,但是当您将鼠标悬停在它上面时,它仍然显示默认颜色。这是一种解决方法...
通过使用 "DropDownOpening" 、 "DropDownClosed" 和 "MouseEnter" 事件,这非常简单。
private void fileToolStripMenuItem_DropDownOpening(object sender, EventArgs e){
// When the user clicks on "File" it will change to red.
fileToolStripMenuItem.ForeColor = Color.Red;
}
private void testToolStripMenuItem_MouseEnter(object sender, EventArgs e){
// When the user hovers over a child of "file" called "test", "file" turns orange.
fileToolStripMenuItem.ForeColor = Color.Orange;
}
private void test2ToolStripMenuItem_MouseEnter(object sender, EventArgs e){
// When the user hovers on a child of "file" called "test2", "file" turns blue.
fileToolStripMenuItem.ForeColor = Color.Blue;
}
private void fileToolStripMenuItem_DropDownClosed(object sender, EventArgs e){
// When the user leaves the "file" menu, it gets restored back to black.
fileToolStripMenuItem.ForeColor = Color.Black;
}