需要知道鼠标悬停事件

需要知道鼠标悬停事件

本文介绍了mfc中的组合框上的鼠标悬停事件:需要知道鼠标悬停事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Developers,



我在MFC中有一个ComboBox。我创建了一个PopUp菜单并附带了ComboBox。

当我点击ComboBox时,我看到弹出菜单显示成功。



到目前为止好的。



我的要求是当我将鼠标悬停在ComboBox上时,我会看到PopUp菜单显示。



如何在ComboBox上实现鼠标悬停。





以下是我为CBN_DROPDOWN事件编写的代码当我点击ComboBox时。我需要为鼠标悬停做同样的事情。任何人都可以告诉我需要实施哪个事件。



Hello Developers,

I have one ComboBox in MFC. I created one PopUp menu and attached with ComboBox.
When I click on ComboBox, I see popup menu getting displayed successfully.

So far so good.

My requirement is when I mouse Hover on ComboBox, I should see PopUp menu getting displayed.

How can I implement Mouse Hover on ComboBox.


Below is the code which I have written for CBN_DROPDOWN event which gets fire when I click on ComboBox. I need to do the same for Mouse Hover. Can anybody tell me which event I need to implement.

void CControlContextDlg::OnCbnDropdownCombo1()
{


	CMenu mnuPopupSubmit;
	mnuPopupSubmit.LoadMenu(IDR_SUBMIT);

	// Get a pointer to the button
	//CButton *pButton;
	CComboBox *pComboBox;
	pComboBox = reinterpret_cast<CComboBox *>(GetDlgItem(IDC_COMBO1));

	// Find the rectangle around the button
	CRect rectSubmitButton;
	pComboBox->GetWindowRect(&rectSubmitButton);

	CPoint pbottom = rectSubmitButton.BottomRight();

	int h = rectSubmitButton.Width();

	CPoint p;
	p.x = pbottom.x - h;
	p.y = pbottom.y;


	// Get a pointer to the first item of the menu
	CMenu *mnuPopupMenu = mnuPopupSubmit.GetSubMenu(0);
	ASSERT(mnuPopupMenu);
	// Find out if the user right-clicked the button
	// because we are interested only in the button
	CPoint point;


	mnuPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, p.x, p.y, this);


}







问候,

欢乐



我尝试过:



我没有尝试任何东西,因为我不知道将用于鼠标悬停的事件。




Regards,
Joy

What I have tried:

I have not tried anything as I am not aware of the event which will be used for mouse Hover.

推荐答案


这篇关于mfc中的组合框上的鼠标悬停事件:需要知道鼠标悬停事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 01:30