À©µµ¿ì ÇÁ·Î±×·¡¹Ö ÀÚ·á |
---|
Á¦¸ñ | [MFC] Ç÷ÎÆà Æ˾÷ ¸Þ´º ¸¸µé±â 1998/08/02 (16:49) |
À̸§ | swindler |
¹øÈ£ | 53 |
Á¶È¸ | 415 |
º»¹® |
Ç÷ÎÆà Æ˾÷ ¸Þ´º´Â »ç¿ëÀÚ°¡ ¿À¸¥ÂÊ ¸¶¿ì½º ¹öÆ°À» Ŭ¸¯Çϸé Ç÷ÎÆà ¸Þ´º´Â ÇöÀç ¼±Åð¡´ÉÇÑ »çÇ×µéÀ» Á¦°øÇØ ÁÖ´Â °ÍÀÌ´Ù. ¸®¼Ò½º ¿¡µðÅÍ¿Í MFC LibraryÀÇ CMenu::TrackPopupMenu() ÇÔ¼ö¸¦ ÀÌ¿ëÇÏ¸é ½±°Ô Ç÷ÎÆà Æ˾÷ ¸Þ´º¸¦ ¸¸µé ¼ö ÀÖ´Ù. 1. ¸Þ´º ¿¡µðÅ͸¦ ÀÌ¿ëÇÏ¿© ÇÁ·ÎÁ§Æ®ÀÇ ¸®¼Ò½º ÆÄÀÏ¿¡ »õ·Î¿î ¸Þ´º¸¦ »ðÀÔÇÑ´Ù. 2. ¿ÞÂÊÀÇ Å¾-·¹º§ Ç׸ñ¿¡ ¹®ÀÚµéÀ» ÀÔ·ÂÇÑ ÈÄ Æ˾÷ ¸Þ´º¿¡ ¸Þ´º ¾ÆÀÌÅÛµéÀ» Ãß°¡ÇÑ´Ù. 3. ClassWizard¸¦ ÀÌ¿ëÇÏ¿© View Class¶Ç´Â ¸¶¿ì½º Ŭ¸¯ ¸Þ½ÃÁö¸¦ Á¢¼öÇÒ À©µµ¿ì Ŭ·¡½º¿¡ WM_CONTEXTMENU¸Þ½ÃÁö Çڵ鷯¸¦ Ãß°¡ÇÑ´Ù. Çڵ鷯 ÄÚµå´Â ´ÙÀ½°ú °°´Ù. CMenu menu; menu.LoadMenu(IDR_MYFLOATMENU); menu.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,point.x,point.y,this); CMenu::GetSubMenu CMenu* GetSubMenu( int nPos ) const; Return Value A pointer to a CMenu object whose m_hMenu member contains a handle to the pop-up menu if a pop-up menu exists at the given position; otherwise NULL. If a CMenu object does not exist, then a temporary one is created. The CMenu pointer returned should not be stored. Parameters nPos Specifies the position of the pop-up menu contained in the menu. Position values start at 0 for the first menu item. The pop-up menu's identifier cannot be used in this function. Remarks Retrieves the CMenu object of a pop-up menu. CMenu::TrackPopupMenu BOOL TrackPopupMenu( UINT nFlags, int x, int y, CWnd* pWnd, LPCRECT lpRect = NULL ); Return Value Nonzero if the function is successful; otherwise 0. Parameters nFlags Specifies a screen-position flag and a mouse-button flag. The screen-position flag can be one of the following: Remarks Displays a floating pop-up menu at the specified location and tracks the selection of items on the pop-up menu. A floating pop-up menu can appear anywhere on the screen. |