winform修改菜单背景色后不显示,依旧是默认背景色,求解答

junlinfushi 2013-10-10 08:48:55
如图所示,我明明修改了背景色,还是没有发生改变,求解答
...全文
705 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
BrokenIce_Ice 2015-06-10
  • 打赏
  • 举报
回复
你找到如何解决的办法了吗?我也遇到了,不知道如何解决
junlinfushi 2013-10-10
  • 打赏
  • 举报
回复
引用 7 楼 guwei4037 的回复:
那就是你这个项目代码的问题了,肯定在某个地方设置了什么属性或写了什么代码,导致设置失效。你得好好查一查。
这个我没设置什么属性,也没写特殊代码,不知道是不是VS2010的问题还是机器问题
junlinfushi 2013-10-10
  • 打赏
  • 举报
回复
引用 8 楼 caozhy 的回复:
[quote=引用 6 楼 junlinfushi 的回复:] [quote=引用 3 楼 caozhy 的回复:]
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;
        }
    }
}
我不是需要代码改背景色,而是设计界面改不了[/quote] 反正我告诉你我测试了是可以修改的。[/quote]我新建项目测试了也可以,就是当前项目改不了,不懂哪里出了问题。
threenewbee 2013-10-10
  • 打赏
  • 举报
回复
引用 6 楼 junlinfushi 的回复:
[quote=引用 3 楼 caozhy 的回复:]
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;
        }
    }
}
我不是需要代码改背景色,而是设计界面改不了[/quote] 反正我告诉你我测试了是可以修改的。
全栈极简 2013-10-10
  • 打赏
  • 举报
回复
那就是你这个项目代码的问题了,肯定在某个地方设置了什么属性或写了什么代码,导致设置失效。你得好好查一查。
junlinfushi 2013-10-10
  • 打赏
  • 举报
回复
引用 3 楼 caozhy 的回复:
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;
        }
    }
}
我不是需要代码改背景色,而是设计界面改不了
junlinfushi 2013-10-10
  • 打赏
  • 举报
回复 1
引用 4 楼 guwei4037 的回复:
刚试了一下是可以的。vs2012,你设置好属性后,运行还是不变吗?
不知道什么原因,我新建一个项目测试一下可以改变背景色,可是原来的项目怎么都改不了,运行之后也改不了,还是默认背景色。
全栈极简 2013-10-10
  • 打赏
  • 举报
回复
刚试了一下是可以的。vs2012,你设置好属性后,运行还是不变吗?
threenewbee 2013-10-10
  • 打赏
  • 举报
回复
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;
        }
    }
}
junlinfushi 2013-10-10
  • 打赏
  • 举报
回复
在线等答案,求速度
junlinfushi 2013-10-10
  • 打赏
  • 举报
回复
VS2010版本

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧