Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Different Right menu for different area

Different Right menu for different area

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialc++designdata-structureshelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Michel_Huang
    wrote on last edited by
    #1

    how to add different Right menu for different area in a MFC UI Procedures,in order to achieve different control and operation. For example ,A Tree List Control,when I Selecte one type of node ,I want it can Show one type of Right menu ,and if I select another type of node ,I wan it to show another kind of Right menu . How to achieve it?Please Help me,thank you ~

    Work hard. Laugh often. Keep your honor. Never to say never

    D K M 3 Replies Last reply
    0
    • M Michel_Huang

      how to add different Right menu for different area in a MFC UI Procedures,in order to achieve different control and operation. For example ,A Tree List Control,when I Selecte one type of node ,I want it can Show one type of Right menu ,and if I select another type of node ,I wan it to show another kind of Right menu . How to achieve it?Please Help me,thank you ~

      Work hard. Laugh often. Keep your honor. Never to say never

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      You can: 1) create a different context menu at design time and bring up the one you need, or 2) create one context menu at design time and modify it at runtime, or 3) create the whole menu at runtime.


      "A good athlete is the result of a good and worthy opponent." - David Crow

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      1 Reply Last reply
      0
      • M Michel_Huang

        how to add different Right menu for different area in a MFC UI Procedures,in order to achieve different control and operation. For example ,A Tree List Control,when I Selecte one type of node ,I want it can Show one type of Right menu ,and if I select another type of node ,I wan it to show another kind of Right menu . How to achieve it?Please Help me,thank you ~

        Work hard. Laugh often. Keep your honor. Never to say never

        K Offline
        K Offline
        kuibing
        wrote on last edited by
        #3

        你可以为每一种邮件添加一个资源菜单,根据不同的item,load相应的resource ID POINT point; UINT uFlags; //得到当前鼠标坐标 GetCursorPos(&point); //转换成客户区坐标 m_ctrlTree.ScreenToClient(&point); //获取选中的Item的句柄 HTREEITEM hItem = m_ctrlTree.HitTest(point,&uFlags); //若句柄不为空,则弹出右键菜单 if(hItem) { hTreeCurrent = hItem; ClientToScreen(&point); VERIFY(menu.LoadMenu(IDR_TREERCLK)); pPopUp = menu.GetSubMenu(0); //IDR_TREERCLK就是你建立的资源 }

        M 1 Reply Last reply
        0
        • M Michel_Huang

          how to add different Right menu for different area in a MFC UI Procedures,in order to achieve different control and operation. For example ,A Tree List Control,when I Selecte one type of node ,I want it can Show one type of Right menu ,and if I select another type of node ,I wan it to show another kind of Right menu . How to achieve it?Please Help me,thank you ~

          Work hard. Laugh often. Keep your honor. Never to say never

          M Offline
          M Offline
          Michel_Huang
          wrote on last edited by
          #4

          감사합니다

          Work hard. Laugh often. Keep your honor. Never to say never

          1 Reply Last reply
          0
          • K kuibing

            你可以为每一种邮件添加一个资源菜单,根据不同的item,load相应的resource ID POINT point; UINT uFlags; //得到当前鼠标坐标 GetCursorPos(&point); //转换成客户区坐标 m_ctrlTree.ScreenToClient(&point); //获取选中的Item的句柄 HTREEITEM hItem = m_ctrlTree.HitTest(point,&uFlags); //若句柄不为空,则弹出右键菜单 if(hItem) { hTreeCurrent = hItem; ClientToScreen(&point); VERIFY(menu.LoadMenu(IDR_TREERCLK)); pPopUp = menu.GetSubMenu(0); //IDR_TREERCLK就是你建立的资源 }

            M Offline
            M Offline
            Michel_Huang
            wrote on last edited by
            #5

            ありがとう

            Work hard. Laugh often. Keep your honor. Never to say never

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups