如何在 TMenuItem 上模拟 OnMouseMove 事件?

How to simulate OnMouseMove event on TMenuItem?

当鼠标光标悬停在某个菜单项 (TMainMenu) 上时,该项目会高亮显示。我想在我的状态栏中添加一个描述菜单项的文本,但我没有 OnMouseMove 或任何类似的 TMenuItem 事件来执行此操作。如何实现?

我正在使用 C++ Builder XE6。 谢谢!

VCL 可以自动为您处理。

将您想要的文本分配给 TMenuItem.Hint 属性:

Specifies the text string that can appear when the user moves the mouse pointer over a menu item.

Set Hint to a string that provides more information about the meaning of the menu item than the Caption. The hint text appears in the Status Bar when the user pauses with the mouse over the menu item if Help Hints are enabled (that is, if the Form's and the Application's ShowHint properties are True). It is also available for the code in the application's OnHint event handler.

然后将 TStatusBar.AutoHint 属性 设置为 true。

Specifies whether the status bar's text is set automatically to the current hint.

Use AutoHint to specify whether the status bar's text is set automatically to the current hint. When AutoHint is True, the status bar automatically responds to hint actions by displaying the long version of the hint's text in the first panel.

TApplication.Hint 属性 的任何更改,例如当鼠标移到 UI 控件或菜单​​项上时,将自动传播到 TStatusBar