如何删除的MenuStrip子菜单的利润率? [英] How to remove MenuStrip submenu margins?

查看:318
本文介绍了如何删除的MenuStrip子菜单的利润率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你知道如何在MenuStri子菜单中去除保证金(可能是一个用于图像和复选框的左和右)?在 MSDN文章有解释了如何将它从上下文菜单中删除。这是写了我应该做它的MenuStrip但MenuStrip中以同样的方式没有ShowImageMargin也不ShowCheckMargin。也许我失去了一些东西。你能帮忙吗?

Do you know how to remove margin (probably the one for image and check box on the left and right) of the submenu in MenuStri? In MSDN article there is explained how to remove it from context menus. It is written that I should do it the same way in MenuStrip but MenuStrip do not have ShowImageMargin nor ShowCheckMargin. Maybe I'm missing something. Can you help?

推荐答案

非常相似,但是,而不是使用的ContextMenuStrip(这是在你的MSDN文章),你必须使用 ToolStripDropDownMenu 。通过这种方式:

Very similar, but instead of using "ContextMenuStrip" (which is used in your MSDN article), you have to use "ToolStripDropDownMenu". This way:

((ToolStripDropDownMenu)noMargins.DropDown).ShowImageMargin = false;

例如,如果你想删除您菜单栏名为menuStrip1所有的图像边缘,添加此码到您的形式初始化程序:

For example, if you want to remove all image margins from your menubar called "menuStrip1", add this code to your form initialization routine:

// Removing image margins (space for icons on left) from menubar items:
foreach (ToolStripMenuItem menuItem in menuStrip1.Items)
    ((ToolStripDropDownMenu)menuItem.DropDown).ShowImageMargin = false;

这篇关于如何删除的MenuStrip子菜单的利润率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆