zoukankan      html  css  js  c++  java
  • PopMenu 弹出式菜单(变灰,禁用,激活)


      
    void CBallsRaceView::OnContextMenu(CWnd* pWnd, CPoint point)
    {
     // TODO: Add your message handler code here
     CMenu menu;
     menu.LoadMenu(IDR_POPMENU);
     //ball0
     if (m_TestBall0_Able)
     {
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball0Wait,MF_ENABLED|MF_BYCOMMAND);
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball0Continue,MF_DISABLED|MF_BYCOMMAND|MF_GRAYED);
     }
     else
     {
      
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball0Wait,MF_DISABLED|MF_BYCOMMAND|MF_GRAYED);
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball0Continue,MF_ENABLED|MF_BYCOMMAND);
     }
     //ball1
     if (m_Ball1_Able)
     {
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball1Wait,MF_ENABLED|MF_BYCOMMAND);
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball1Continue,MF_DISABLED|MF_BYCOMMAND|MF_GRAYED);
     }
     else
     {
      
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball1Wait,MF_DISABLED|MF_BYCOMMAND|MF_GRAYED);
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball1Continue,MF_ENABLED|MF_BYCOMMAND);
     }
     //ball2
     if (m_Ball2_Able)
     {
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball2Wait,MF_ENABLED|MF_BYCOMMAND);
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball2Continue,MF_DISABLED|MF_BYCOMMAND|MF_GRAYED);
     }
     else
     {
      
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball2Wait,MF_DISABLED|MF_BYCOMMAND|MF_GRAYED);
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball2Continue,MF_ENABLED|MF_BYCOMMAND);
     }
     //ball3
     if (m_Ball3_Able)
     {
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball3Wait,MF_ENABLED|MF_BYCOMMAND);
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball3Continue,MF_DISABLED|MF_BYCOMMAND|MF_GRAYED);
     }
     else
     {
      
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball3Wait,MF_DISABLED|MF_BYCOMMAND|MF_GRAYED);
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball3Continue,MF_ENABLED|MF_BYCOMMAND);
     }
     //ball4
     if (m_Ball4_Able)
     {
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball4Wait,MF_ENABLED|MF_BYCOMMAND);
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball4Continue,MF_DISABLED|MF_BYCOMMAND|MF_GRAYED);
     }
     else
     {
      
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball4Wait,MF_DISABLED|MF_BYCOMMAND|MF_GRAYED);
      menu.GetSubMenu(0)->EnableMenuItem(ID_Ball4Continue,MF_ENABLED|MF_BYCOMMAND);
     }
     
     CPoint posMouse;
     GetCursorPos(&posMouse);
      //显示菜单
     // ClientToScreen(&posMouse);
    // menu.GetSubMenu(0)->EnableMenuItem(ID_Ball0Wait,MF_ENABLED|MF_BYCOMMAND);
    // menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,point.x,point.y,this);
     menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,posMouse.x,posMouse.y,this);
    }
  • 相关阅读:
    k8s默认调度器常见调度算法解析
    K8s集群相关证书
    flannel overlay网络浅析
    Pod挂载LocalStoragePv过程理解
    k8s开发实践
    Flex布局【弹性布局】学习
    python中的技巧——杂记
    Tarjan + bfs HYSBZ 1179Atm
    POJ1988 Cube stacking(非递归)
    将博客搬至CSDN
  • 原文地址:https://www.cnblogs.com/huking/p/1545792.html
Copyright © 2011-2022 走看看