winform修改菜单背景色后不显示,依旧是默认背景色,求解答
如图所示,我明明修改了背景色,还是没有发生改变,求解答 winform 背景色
[解决办法]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
foreach (ToolStripItem item in menuStrip1.Items)
{
EnumChildMenu(item);
}
}
private void EnumChildMenu(ToolStripItem tsi)
{
OnFind(tsi);
if (tsi is ToolStripMenuItem)
{
ToolStripMenuItem tsmi = tsi as ToolStripMenuItem;
foreach (ToolStripItem item in tsmi.DropDownItems)
{
EnumChildMenu(item);
}
}
}
private void OnFind(ToolStripItem tsi)
{
tsi.BackColor = Color.Blue;
}
}
}