CMenu::TrackPopupMenu
来源:百度文库 编辑:神马文学网 时间:2024/04/29 06:47:34
CMenu::TrackPopupMenu
Call this member function to display a floating pop-up menu at the specified location, and track the selection of items on the pop-up menu.
Syntax
BOOL TrackPopupMenu ( UINT nFlags, int x, int y, CWnd* pWnd, LPCRECT lpRect = 0 );
nFlags
Specifies a screen-position flag and a mouse-button flag. The screen-position flag can be one of the following:
- TPM_CENTERALIGN Centers the pop-up menu horizontally relative to the coordinate specified by x. //菜单上边界中点的X轴坐标为X
- TPM_LEFTALIGN Positions the pop-up menu so that its left side is aligned with the coordinate specified by x.//菜单左边界中点的X轴坐标为X
- TPM_RIGHTALIGN Positions the pop-up menu so that its right side is aligned with the coordinate specified by x. //菜单右边界中点的X轴坐标为X
The mouse-button flag can be either of the following:
- TPM_LEFTBUTTON Causes the pop-up menu to track the left mouse button.
//菜单跟踪鼠标左键
- TPM_RIGHTBUTTON Causes the pop-up menu to track the right mouse button.
//菜单跟踪鼠标右键
x: 设置菜单的X轴位置(屏幕坐标)
y:设置菜单的Y轴位置(屏幕坐标)
pWnd 指定菜单的父窗口。
lpRect 设置一个Rect结构或者一个CRect对象,在改矩形区域那按鼠标键,菜单不会消失;如果设为
NULL,只要在菜单以外的位置按鼠标键,菜单就会消失。