7风格的上下文菜单

7风格的上下文菜单

本文介绍了如何显示在Windows 7风格的上下文菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的.NET应用程序,上下文菜单看起来像左边。

In my .NET applications, context menus look like the left one.

我如何应用Windows 7风格的他们,以使它们看起来就像是正确的?

How can I apply the Windows 7 style on them in order to make them look like the right one?

推荐答案

右键单击工具箱中,选择项目。勾选文本菜单,一个与命名空间= System.Windows.Forms的和目录=全局程序集缓存。

Right-click the tool box, Choose Items. Tick "ContextMenu", the one with Namespace = System.Windows.Forms and Directory = Global Assembly Cache.

这.NET 1.x的成分是截然不同的ContextMenuStrip,它采用原生的Windows菜单。你会失去一些功能,我怀疑你的关心。你需要写一行code分配菜单,设计者只允许您设置的ContextMenuStrip属性。加入该行的构造函数,如:

This .NET 1.x component is distinct from ContextMenuStrip, it uses native Windows menus. You'll lose some capabilities, I doubt you care. You'll need to write a line of code to assign the menu, the designer only lets you set the ContextMenuStrip property. Add that line to the constructor, like:

    public Form1() {
        InitializeComponent();
        this.ContextMenu = contextMenu1;
    }

这篇关于如何显示在Windows 7风格的上下文菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 18:44