如何在 C# 中创建 ContextMenuStrip 哪些项目是图像?

发布于 2024-07-09 18:18:52 字数 173 浏览 3 评论 0原文

我想在 C# 中创建上下文菜单,其中项目是不同高度和宽度的图像。

我不知道如何解决的主要问题是如何设置菜单项和上下文菜单的宽度和高度。

如果启用了菜单项的自动调整大小,则所有菜单项的高度都相同。 如果我禁用菜单项的自动调整大小,则我无法正确设置上下文菜单的宽度 - 它不尊重菜单项的宽度。

I want to create context menu in C# which items are images of different heights and widths.

Main problem I don't know how to solve is how to set width and height for menu items and context menu.

If autosize for menu items is enabled, then heights of all menu items are the same. If I disable autosize for menu items, then I cannot properly set the width of context menu - it is not respecting widths of menu items.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与风相奔跑 2024-07-16 18:18:52

请尝试这个场景:

this.toolStripMenuItem2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;

Please try this scenario:

this.toolStripMenuItem2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文