显示工具提示的菜单项 [英] Showing a tooltip for a MenuItem

查看:72
本文介绍了显示工具提示的菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含,除其他事项外,一些最最近使用的文件路径的菜单。这些文件的路径可能会很长,所以文字有时会被截断,如C:\ PROGRA ... \ foo.txt的

I've got a menu that contains, among other things, some most-recently-used file paths. The paths to these files can be long, so the text sometimes gets clipped like "C:\Progra...\foo.txt"

我想,当用户将鼠标悬停在项目上弹出一个提示的完整路径,但这似乎不可能用的Tooltip 类.NET 2.0。

I'd like to pop a tooltip with the full path when the user hovers over the item, but this doesn't seem possible with the Tooltip class in .NET 2.0.

我失去了一些东西明显?

Am I missing something obvious?

推荐答案

如果您正在使用的 System.Windows.Forms.MenuItem 类,你会不会有一个的ToolTipText属性。

If you are creating your menu items using the System.Windows.Forms.MenuItem class you won't have a "ToolTipText" property.

您应该使用这是新的.NET Framework 2.0的和确实包括了的ToolTipText属性System.Windows.Forms.ToolStripMenuItem 类。

您还必须记住指定ShowItemToolTips = TRUE在MenuStrip控件

You also have to remember to specify ShowItemToolTips = True on the MenuStrip control

这篇关于显示工具提示的菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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