【问题标题】:MetroFramework MenuStrip Toolbox issueMetroFramework MenuStrip 工具箱问题
【发布时间】:2016-11-04 00:12:00
【问题描述】:

我会简短而具体地说:

http://prnt.sc/d2t8k7

我为 MetroFramework 安装了软件包,但没有 MetroMenuStrip 和其他工具。

当我在网上搜索时,我看到了太多关于 MetroMenuStrip 的例子。但是没有人像我一样有任何问题。

我尝试了所有这些包代码:

  • 安装包 Winform.Metroframework

  • 安装包 MetroFramework

  • 安装包 MetroModernUI

  • 安装包 MetroFramework.Design

谢谢。

【问题讨论】:

  • 你能以编程方式引用这些类型吗?也许您的工具箱视图是stale
  • 您能否详细描述一下您的问题?欢迎对您的问题进行编辑:-)
  • 我需要在 Metro Tab 中添加更多工具。工具太多了,我只有20个。

标签: c# package microsoft-metro frame menustrip


【解决方案1】:

终于找到了办法……

我通过编写以下代码将 MenuStrip 添加到此框架中:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ModernUISample.metro
{
    /// <summary>
    /// Menustrip for ModernUI-GUIs
    /// </summary>
    public class MetroMenuStrip : System.Windows.Forms.MenuStrip
    {
        /// <summary>
        /// Constructor
        /// </summary>
        public MetroMenuStrip()
            : base()
        {
            Renderer = new metroToolStripRenderer();
            Font = MetroUI.Style.BaseFont;
            ForeColor = MetroUI.Style.ForeColor;
        }

        /// <summary>
        /// OnItemAdded-Event we adjust the font and forecolor of this item
        /// </summary>
        /// <param name="e"></param>
        protected override void OnItemAdded(System.Windows.Forms.ToolStripItemEventArgs e)
        {
            base.OnItemAdded(e);

            e.Item.Font = MetroUI.Style.BaseFont;
            e.Item.ForeColor = MetroUI.Style.ForeColor;
        }
    }
}

在您的项目中创建一个文件。 并在此文件中创建类为“MetroMenuStrip.cs”

并使用此代码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-25
    • 1970-01-01
    • 2012-12-23
    • 1970-01-01
    • 2018-06-26
    • 2013-09-07
    • 2011-11-16
    相关资源
    最近更新 更多