我怎么才能知道用户鼠标在菜单的哪个菜单项上移动?

huang_jihua 2002-12-19 10:45:04
我是想这样做:
当用户鼠标在菜单项上移动时,状态栏上显示相关的提示信息。请大家帮帮忙。
...全文
128 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
huang_jihua 2002-12-19
  • 打赏
  • 举报
回复
谢谢各位了,马上给分
frankxht 2002-12-19
  • 打赏
  • 举报
回复
bcb真是功能强大,这样的功能都有完善的提供啊....

看来我要学的还很多啊.
大大怪老张 2002-12-19
  • 打赏
  • 举报
回复
呵呵
frankxht 2002-12-19
  • 打赏
  • 举报
回复
good sample!....
书生 2002-12-19
  • 打赏
  • 举报
回复
2楼的。

Hint属性,
lingbin 2002-12-19
  • 打赏
  • 举报
回复
高置Hint属性和编写OnHint事件就可以了,像空心菜说的那样。
frankxht 2002-12-19
  • 打赏
  • 举报
回复
我的思路是这样的,但由于时间关系,你自己试试.
例如file菜单有new,save子菜单;在file中的onClick事件给父类(Form1)的OnMouseMove事件发送一个消息,对鼠标所在位置做处理;void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift,int X, int Y){
if(x>i&&x<j&&y>k&&y<d)
//显示帮助信息;
}
invalid 2002-12-19
  • 打赏
  • 举报
回复
处理menu的OnHint跟鼠标在哪里移动没有关系的。
把menu的Hint设置好,然后ShowHint设置为true。
然后参照help中的例子;
This example uses a status bar, a menu, and an edit box on a form. Include a value for the Hint property for each menu item in the menu. Also, specify a value for the Hint property of the edit box. Align the status bar at the bottom of the form.
Declare the DisplayHint method as a public procedure of the Form:

class TForm1 : public TForm

{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
void __fastcall DisplayHint(TObject *Sender); // add this line

};

Here is the code to add to the unit file. It provides the implementation of the DisplayHint method and assigns it to the Application in the form抯 OnCreate event handler.

void __fastcall TForm1::DisplayHint(TObject *Sender)
{
StatusBar1->SimpleText = GetLongHint(Application->Hint);
}

// Here is the form抯 OnCreate event handler.

// It assign抯 the application抯 OnHint event handler at runtime
// because the Application is not available in the Object Inspector
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Application->OnHint = DisplayHint;
}

Note: It is not actually necessary to write an OnHint event handler to display hints on the status bar. This can be accomplished more simply by setting the status bar抯 AutoHint property.
yangguo_god 2002-12-19
  • 打赏
  • 举报
回复
mark,去试试

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧