先自己建一个menu,给对应选项改ID,然后映射事件
ON_COMMAND(ID_DrawPress, &CUnconventionalChartDlg::OnMenuDearPress)
ON_COMMAND(ID_DrawDay, &CUnconventionalChartDlg::OnMenuDearDay)
void CUnconventionalChartDlg::OnMenuDearPress()
{
AfxMessageBox(_T("ddd"));
}
//右键
if (Button == mbRight)
{
CRect rect;
m_Tchart.GetWindowRect(&rect);
CPoint p;
GetCursorPos(&p);//鼠标点的屏幕坐标
if (rect.PtInRect(p))
{
CMenu menu;
menu.LoadMenu(IDR_MENU_TeeChart);//编辑好的菜单资源
CMenu *SubMenu = menu.GetSubMenu(0);
SubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, p.x, p.y, this);
}
}
C++—TeeChart 右键事件
最新推荐文章于 2021-01-12 11:23:46 发布