ÓÑÇéÌáʾ£ºÈç¹û±¾ÍøÒ³´ò¿ªÌ«Âý»òÏÔʾ²»ÍêÕû£¬Çë³¢ÊÔÊó±êÓÒ¼ü¡°Ë¢Ð¡±±¾ÍøÒ³£¡
µÚÈýµç×ÓÊé ·µ»Ø±¾ÊéĿ¼ ¼ÓÈëÊéÇ© ÎÒµÄÊé¼Ü ÎÒµÄÊéÇ© TXTÈ«±¾ÏÂÔØ ¡ºÊղص½ÎÒµÄä¯ÀÀÆ÷¡»

CÓïÑÔʵÀý½Ì³Ì(PDF¸ñʽ)-µÚ26²¿·Ö

¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿! Èç¹û±¾ÊéûÓÐÔĶÁÍ꣬ÏëÏ´μÌÐø½Ó×ÅÔĶÁ£¬¿ÉʹÓÃÉÏ·½ "Êղص½ÎÒµÄä¯ÀÀÆ÷" ¹¦ÄÜ ºÍ "¼ÓÈëÊéÇ©" ¹¦ÄÜ£¡




Ê×ÏÈ£¬ÓÉÓڶԲ˵¥µÄ¶¯Ì¬¸Ä±äÔڲ˵¥IDR_MAINFRAME1µÄ²Ëµ¥ÏîÖÐʵ¡¡

ÏÖ£¬Òò´Ë£¬ÎÒÃÇËùÒª×öµÄµÚÒ»²½¹¤×÷¾ÍÊÇʵÏֲ˵¥IDR_MAINFRAME1¶Ô¡¡

²Ëµ¥IDR_MAINFRAME0µÄ¶¯Ì¬Ìæ»»¡£Õâ¿ÉÒÔÓÃCWndÀàµÄÒ»¸ö³ÉÔ±º¯Êý¡¡

SetMenuʵÏÖ¡£º¯ÊýSetMenuµÄÔ­ÐÍΪ£º¡¡¡¡



BOOL¡¡SetMenu£¨CMenu¡¡*¡¡pMenu£©£»¡¡¡¡



ÆäÖÐpMenuΪһָÏòÓûÌæ»»Ô­Óв˵¥µÄÒ»CMenuÀàµÄ¶ÔÏóµÄÖ¸Õ룬º¯Êý¡¡

µÄ·µ»ØÖµ½ö½öÔڲ˵¥Ã»Óз¢Éú¸Ä±äʱΪ0¡£¡¡¡¡



¡¡¡¡l¡¡×¢Ò⣺¡¡¡¡



¡¡¡¡l¡¡Èç¹ûÄãÒÔ¿ÕÖµNULL×÷ΪָÏòCMenuµÄÖ¸Õ룬ÄÇÄãµÄ³ÌÐòµÄ²Ëµ¥¾ÍËã¡¡

¡¡¡¡¡¡ÏûʧÁË¡£³ý·ÇÔÚ³ÌÐòÖÐÒÔÊʵ±·½Ê½¸æËßÓû§ÖØеõ½²Ëµ¥µÄ·½¡¡

¡¡¡¡¡¡·¨£¬Óû§ºÜÄÑÔٵõ½²Ëµ¥ÁË¡£²»¹ý£¬ÔÚһЩÇéÐÎÏ£¬ÊµÏֲ˵¥µÄ¡¡

¡¡¡¡¡¡ÏûÒþ/ÏÔʾ¿ÉÒÔʵÏÖ¶ÔÆÁÄ»ÏÔʾ¿Õ¼äµÄÓÐЧ¹ÜÀí¡£¡¡¡¡



¾¡¹Üͨ¹ýµÚËÄÕµÄѧϰ£¬ÄãÒѾ­ÕÆÎÕÁËһЩÔÚ³ÌÐòÖÐÌí¼ÓÏûÏ¢ÏìÓ¦º¯¡¡

ÊýµÄ·½·¨£¬µ«»ùÓÚÎĵµ/ÊӽṹµÄ³ÉÔ±º¯ÊýµÄÌí¼Ó»¹ÊÇÓÐ×Ô¼ºµÄºÜ´ó¡¡

³Ì¶ÈÉϵIJ»Í¬¡£ÔÚÎÒÃÇÒѾ­Éú³ÉµÄ³ÌÐòÖУ¬Ìí¼Ó¶Ô²Ëµ¥ÏûÏ¢µÄÏìÓ¦µÄ¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡214¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

º¯ÊýÊÇÓÐһЩ×Ô¼ºµÄÌØÊâÐԵġ£ÏÂÃæÎÒÃǽáºÏͼʾ˳Ðò½²½â¡£¡¡¡¡



1¡£¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Ôڲ˵¥ÏîÉÏ»òÔ´´úÂë±à¼­ÇøÖÐÓÒ»÷Êó±ê£¬»òÑ¡Ôñ¡¡

View/ClassWizard¡­²Ëµ¥Ï´ò¿ªClassWizard¶Ô»°¿ò¡£¡¡¡¡



2¡£¡¡¡¡ÔÚClass¡¡¡¡name£ºÑ¡ÏîÖУ¬È·ÈÏΪCMainFrame£¬ÔÚObject¡¡¡¡IDs£ºÖÐÑ¡¡¡

ÔñID_VIEW_LONGMENU£»ÔÚMessage£ºÑ¡ÏîÖÐÑ¡ÔñMAND£¬Èçͼ5¡£13¡£¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Í¼5¡£¡¡13¡¡Îª²Ëµ¥ÏîÔö¼ÓÏûÏ¢ÏìÓ¦º¯Êý¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Í¼5¡£¡¡14¡¡Ñ¡ÔñÏìÓ¦º¯ÊýÃû³Æ¡¡¡¡



3¡£¡¡¡¡µ¥»÷Add¡¡Class¡­ÎªÏìÓ¦º¯ÊýÃüÃû¡¡£¨Èçͼ5¡£14Ëùʾ£©£¬Ò»°ã˵£¬½Ó¡¡

ÊÜϵͳÌṩµÄȱʡÃû¾Í×ã¿ÉÒÔÁË¡£¡¡¡¡



4¡£¡¡µ¥»÷OKºó½øÈëÔ´´úÂë±à¼­Çø½øÐб༭¡£¡¡¡¡



ÈçÏÂËùʾ£¬ÎªÎÒÃÇΪº¯ÊýOnViewLongmenuËù¼ÓµÄ´úÂ룺¡¡¡¡



void¡¡CMainFrame£º£ºOnViewLongmenu£¨£©¡¡¡¡¡¡



£û¡¡¡¡



//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡



SetMenu£¨&hLongMenu£©£»¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡215¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

£ý¡¡¡¡



Àí½âÕâ¶Î´úÂë²¢²»À§ÄÑ£¬µ«²ÎÊýhLongMenu´ÓºÎ¶øÀ´£¿ÕâÊÇÎÒÃÇÔÚ³ÌÐò¡¡

Öд´½¨µÄÒ»¸ö±êʶ²Ëµ¥IDR_MAINFRAME1µÄCMenuÀàµÄÒ»¸ö¶ÔÏó¡£ÔÚÎÄ¡¡

¼þMainFrm¡£cppµÄÏÂʾº¯ÊýÖÐÎÒÃǶÔÆä½øÐÐÁ˳õʼ»¯¡¡£¨ÕâÁ½´¦´úÂë¾ùÊÇ¡¡

ÊÖ¹¤¼ÓÈëµÄ£©£º¡¡¡¡



int¡¡CMainFrame£º£ºOnCreate£¨LPCREATESTRUCT¡¡lpCreateStruct£©¡¡¡¡



£û¡¡¡¡



//¡¡¡£¡£¡£¡¡¡¡



hLongMenu¡£LoadMenu£¨IDR_MAINFRAME1£©£»¡¡¡¡¡¡



//¡¡¡£¡£¡£¡¡¡¡



£ý¡¡¡¡



¶øÆ䶨ÒåÔÚÍ·ÎļþMainFrm¡£hÖУº¡¡¡¡



class¡¡CMainFrame¡¡£º¡¡public¡¡CFrameWnd¡¡¡¡



£û¡¡¡¡



//¡¡¡£¡£¡£¡¡¡¡



CMenu¡¡hLongMenu£»¡¡¡¡



//¡¡¡£¡£¡£¡¡¡¡



£ý¡¡¡¡¡¡



¶ÔView²Ëµ¥µÄÇ°Èý¸ö²Ëµ¥ÏîµÄÏìÓ¦Éæ¼°µ½GDI»æͼµÄһЩ֪ʶ£¬¶ÁÕß¡¡

Èç¹ûÔÝʱŪ²»Çå³þ£¬¿ÉÒÔÁô´ý¿´¹ýÏàÓ¦Õ½ںóÔÙ»ØÍ·À´Àí½â¡£ÏÂÃæÎÒ¡¡

ÃÇ¿´Ò»¿´¶Ô²Ëµ¥µÄ¶¯Ì¬²Ù×÷¡£¡¡¡¡



¡¡¡¡¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡216¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Í¼5¡£¡¡15¡¡ÔÚ³ÌÐòÖÐÔö¼Óλͼ×ÊÔ´¡¡¡¡



ÔÚÇ°ÃæµÄµÚËÄÕµÄÄǸöÀý³ÌÖУ¬ÎÒÃǶÔÕâÀàʵÏÖ×÷ÁËЩ¼òÒªµÄ½éÉÜ£¬¡¡

ÔÚÕâÀÎÒÃǽáºÏ±¾ÕµijÌÐò×÷һЩ¸üÉîÈëµÄ½éÉÜ¡£¡¡¡¡



Ê×ÏÈ£¬¶Ô²Ëµ¥µÄ¶¯Ì¬²Ù×÷µÄ¼¸¸öº¯Êý£¬Æä×îºóÒ»¸ö²ÎÊý¶¼¿ÉÒÔÓÃÒ»¸ö¡¡

λͼָÕëÌæ´ú¡£±¾ÕÂÀý³ÌÖÐDraw²Ëµ¥ÏµÄͼ·û²Ëµ¥¼´ÓÉ´ËʵÏÖ¡£µ±¡¡

È»£¬ÒªÊ¹ÓÃλͼ×÷Ϊ²Ëµ¥ÏÊ×ÏȱØÐë´´½¨Î»Í¼×ÊÔ´¡£¡¡¡¡



ÔÚVisual¡¡¡¡C£«£«²Ëµ¥ÖÐÑ¡ÔñInsert/Resource¡­£»ÔÙÔÚµ¯³öµÄ¶Ô»°¿òÖÐÑ¡¡¡

ÔñBitmap£¬Èçͼ5¡£15Ëùʾ¡£¡¡¡¡



Èç¹ûÓÐÏֳɵÄλͼ£¬¿ÉÒÔÑ¡ÔñImport¡­£¬µ±È»£¬ÔںܶàÇé¿öÏ£¬ÎÒÃÇ¡¡

¿ÉÒÔÑ¡NewÖ±½ÓÔÚ×ÊÔ´±à¼­Æ÷ÖжÔËüÃǽøÐд´½¨¡¢±à¼­¡£Î»Í¼±à¼­Æ÷¡¡

µÄʹÓúÜÈÝÒ×ÕÆÎÕ£¬Ôڴ˲»ÔÙ׸Êö¡£Í¼ÐοÉÒԲο¼Ç°ÃæµÄ²åͼ¡£ÏÂÃæ¡¡

µÄ´úÂëÕª×ÔMenu¡£rc£¬ÒÔ±ã¶ÁÕßÔÚÖ¸¶¨Î»Í¼ÊôÐÔʱ×÷²Î¿¼¡£¡¡¡¡



IDB_LINE¡¡BITMAP¡¡DISCARDABLE¡¡¡¨resline¡£bmp¡¨¡¡¡¡



IDB_CIRCLE¡¡BITMAP¡¡DISCARDABLE¡¡¡¨resbitmap1¡£bmp¡¨¡¡¡¡



IDB_RECTANGLE¡¡BITMAP¡¡DISCARDABLE¡¡¡¨resrectangl¡£bmp¡¨¡¡¡¡



IDB_TEXT¡¡BITMAP¡¡DISCARDABLE¡¡¡¨resbmp00001¡£bmp¡¨¡¡¡¡



ͬʱ£¬µ±È»Ò²Ó¦¸Ã×¢ÒâÓ³ÉäµÄ¹Øϵ¡£Ö»ÒªÓëÓûÖ´Ðиù¦ÄܵÄ×Ö·û²Ëµ¥¡¡

ÏîµÄIDºÅÒ»Ö£¬ÄÇô£¬ËüÃÇËùʵÏֵŦÄܾÍÊÇÒ»ÑùµÄ¡£ÏÂÃæµÄ¼¸Ðдú¡¡

ÂëÕª×ÔMainFrm¡£cpp¡¡¡¡



void¡¡CMainFrame£º£ºOnChange£¨£©¡¡¡¡¡¡



£û¡¡¡¡



//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡



if£¨£¡bBitmap£©¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡217¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

£û¡¡¡¡



bBitmap=TRUE£»¡¡¡¡



CMenu¡¡*pMenu=GetMenu£¨£©£»¡¡¡¡



CMenu¡¡*pSubMenu=pMenu¡­¡·GetSubMenu£¨3£©£»¡¡¡¡



pSubMenu¡­¡·ModifyMenu£¨ID_DRAW_LINE£»MF_BYMAND£»ID_DRAW_LINE£»&hLine£©£»¡¡¡¡



pSubMenu¡­¡·ModifyMenu£¨ID_DRAW_CIRCLE£»MF_BYMAND£»ID_DRAW_CIRCLE£»&hCircle£©£»¡¡¡¡



pSubMenu¡­¡·ModifyMenu£¨ID_DRAW_RECTANGLE£»¡¡¡¡



MF_BYMAND£»ID_DRAW_RECTANGLE£»&hRectangle£©£»¡¡¡¡



pSubMenu¡­¡·ModifyMenu£¨ID_CHANGE£»MF_BYMAND£»ID_CHANGE£»&hText£©£»¡¡¡¡



£ý¡¡¡¡



else¡¡¡¡



£û¡¡¡¡



bBitmap=FALSE£»¡¡¡¡



CMenu¡¡*pMenu=GetMenu£¨£©£»¡¡¡¡



CMenu¡¡*pSubMenu=pMenu¡­¡·GetSubMenu£¨3£©£»¡¡¡¡



pSubMenu¡­¡·ModifyMenu£¨ID_DRAW_LINE£»MF_BYMAND£»ID_DRAW_LINE£»¡¨&Line¡¨£©£»¡¡¡¡



pSubMenu¡­¡·ModifyMenu£¨ID_DRAW_CIRCLE£»MF_BYMAND£»ID_DRAW_CIRCLE£»¡¨&Circle¡¨£©£»¡¡¡¡



pSubMenu¡­¡·ModifyMenu£¨ID_DRAW_RECTANGLE£»¡¡¡¡



MF_BYMAND£»ID_DRAW_RECTANGLE£»¡¨&Rectangle¡¨£©£»¡¡¡¡¡¡



pSubMenu¡­¡·ModifyMenu£¨ID_CHANGE£»MF_BYMAND£»ID_CHANGE£»¡¨&Bitmap¡¨£©£»¡¡¡¡



£ý¡¡¡¡



£ý¡¡¡¡¡¡



¶øÏÂÃæÕâ¶Î³ÌÐòÍê³ÉÁËλͼ×ÊÔ´µÄ×°ÈëÓë³õʼ»¯£º¡¡¡¡



int¡¡CMainFrame£º£ºOnCreate£¨LPCREATESTRUCT¡¡lpCreateStruct£©¡¡¡¡



£û¡¡¡¡



//¡¡¡£¡£¡£¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡218¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

hLine¡£LoadBitmap£¨IDB_LINE£©£»¡¡¡¡



hCircle¡£LoadBitmap£¨IDB_CIRCLE£©£»¡¡¡¡



hRectangle¡£LoadBitmap£¨IDB_RECTANGLE£©£»¡¡¡¡



hText¡£LoadBitmap£¨IDB_TEXT£©£»¡¡¡¡



//¡¡¡£¡£¡£¡¡¡¡



£ý¡¡¡¡



¹¤×÷¼ä£¬´Ëʱ£¬ÏµÍ³¼ì²âµ½×ÊÔ´ÒѾ­ÔÚϵͳÍⲿ·¢Éú±ä»¯£¬Ñ¯ÎÊÊÇ·ñ¡¡

ÖØ×éÊý¾Ý¿â£¬Ñ¡ÔñÊÇ£¬ÎÒÃÇËùÐèÒªµÄ¾ÍÒѾ­È«²¿×¼±¸Íê±Ï¡£ÏÂÃæ¸ø³ö¡¡

ÕâÒ»±ä»¯Ç°ºóÎļþMenu¡£rcµÄ±ä»¯Çé¿ö¡£¡¡¡¡



//¸Ä±äÒÔÇ°£º¡¡¡¡



POPUP¡¡¡¨&Help¡¨¡¡¡¡



BEGIN¡¡¡¡



MENUITEM¡¡¡¨&About¡¡Menu¡£¡£¡£¡¨£»¡¡ID_APP_ABOUT¡¡¡¡



MENUITEM¡¡¡¨&I¡¡¡¯m¡¡Menu¡¡inserted¡¨£»¡¡ID_HELP_INSERT¡¡¡¡¡¡



//ÉÏÃæÕâÐдúÂëÎÒÃÇÔÚʵÏÖÁËÏûÏ¢Ó³Éäºó½«½«Æäɾ³ý¡¡¡¡



END¡¡¡¡



//¸Ä±äÒԺ󣺡¡¡¡



POPUP¡¡¡¨&Help¡¨¡¡¡¡



BEGIN¡¡¡¡



MENUITEM¡¡¡¨&About¡¡Menu¡£¡£¡£¡¨£»¡¡ID_APP_ABOUT¡¡¡¡



END¡¡¡¡



ͨ¹ýÒÔÉϵıȽÏÎÒÃDz»ÄÑ·¢ÏÖ£¬Ê¹ÓõڶþÖÖ·½Ê½½øÐÐÐÞ¸ÄÊDZȽϷ½±ã¡¡

µÄ¡£¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Í¼5¡£¡¡16¡¡ÏµÍ³²Ëµ¥¸Ä±äºóµÄÈÎÎñÌõ¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡219¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

ÏÂÃæÎÒÃǽ²Ò»ÏÂÓйØϵͳ²Ëµ¥µÄÏûÏ¢ÏìÓ¦ÎÊÌâ¡£Èçͼ5¡£16£¬ÔÚÎÒÃǸġ¡

±äϵͳ²Ëµ¥ºó£¬µ±ÔÚÈÎÎñÀ¸ÓÒµ¥»÷Êó±êʱ£¬µ¯³öµÄϵͳ²Ëµ¥¾ßÓÐÁËÓë¡¡

Ô­À´²»Í¬µÄÐÎʽ¡£¡¡¡¡



˳±ãÌáһϣ¬Èç¹ûÎÒÃDz»Ï£ÍûÓû§ÔÚ³ÌÐòÍⲿֱ½ÓÍ˳ö³ÌÐò£¬¸Ä±äϵ¡¡

ͳ²Ëµ¥¾ÍÊÇÕâ¸ö·½·¨µÄÒ»¸ö;¾¶¡££¨Èç¹û½«ÏµÍ³²Ëµ¥ÉèΪNULL£¬Óû§¡¡

¾ÍÖ»ÓнøÈëÓ¦ÓóÌÐò½øÐÐÑ¡ÔñÁË¡£µ±È»£¬³ý·ÇÕâÊDZØÒªµÄ£¬·ñÔò£¬²»¡¡

ҪǿÆÈÓû§¸Ä±äËûÃǵIJÙ×÷Ï°¹ß¡££©¡¡¡¡



Ê×ÏÈ£¬ÎÒÃDZØÐëÈ¡µÃϵͳ²Ëµ¥£¬Õâ¿ÉÒÔͨ¹ýµ÷ÓÃCWndÀàµÄÒ»¸ö³ÉÔ±º¯¡¡

ÊýGetSystemMenu£©´ïµ½¡£´Ëº¯ÊýµÄÔ­ÐÍΪ£º¡¡¡¡



CMenu¡¡*GetSystemMenu£¨BOOL¡¡bRevert£©¡¡const£»¡¡¡¡



ÔÚÒÔTRUE×÷ΪbRevertµÄÖµ½øÐе÷ÓÃʱ£¬»Ö¸´Ô­ÏµÍ³²Ëµ¥ÉèÖá£ÔÚ¸ü¡¡

¶àµÄÇé¿öÏ£¬ÎÒÃÇÒÔFALSE½øÐе÷Ó㬴ËʱÎÒÃÇ¿ÉÒÔ¶Ôϵͳ²Ëµ¥½øв¡¡

Ù×÷¡¡¡£µÇ£ÃÏ¢ÏìÓ£¿£¿/FONT¡·OnSysmandº¯Êý£¬¶øÇÒ£¬´ËÏûÏ¢Ïì¡¡

Ó¦º¯ÊýÊÇϵͳÉ趨µÄ£¬²»ÔÊÐí³ÌÐòÔ±ÁíÐÐÖ¸¶¨¡£¡¡¡¡



¡¡¡¡l¡¡×¢Ò⣺¡¡¡¡



¡¡¡¡l¡¡ÎÒÃÇ¿ÉÒÔͨ¹ýϵͳÌṩµÄSpy£«£«À´²é¿´ÏµÍ³²Ëµ¥µÄÏûÏ¢·¢Ëͼ°ÏìÓ¦¡¡

¡¡¡¡¡¡×´¿ö¡£ÖÁÓÚÏêϸµÄÇé¿ö£¬ÔÚÎÒÃÇËæºó¸ø³öÁËÏêϸµÄ½âÊÍ¡£Óë¸ÃÏû¡¡

¡¡¡¡¡¡Ï¢ÏàÓ¦µÄ´úÂ룬ÎÒÃǽ«ÓþßÓе×ÎƵÄÎÄ×Ö±ê³ö¡£¡¡¡¡



ÔÚ±¾ÕµÄ×îºó£»ÎÒÃDz»·ÁÀ´¿´¿´ÔõÑùÔÚ³ÌÐòÖÐʵÏÖÓÒ»÷Êó±êʱ³öÏֵġ¡

ÉÏÏÂÎIJ˵¥£»ÓëÇ°ÃæÎÒÃÇËùÓöµ½µÄÆäËûµ¯³öʽ²Ëµ¥ÔÚCmainFrameÖÐʵ¡¡

ÏÖ²»Í¬£»ÉÏÏÂÎIJ˵¥ÒªÔÚÀàCmenuViewÖÐʵÏÖ¡£´Ó±¾ÖÊÉÏÀ´Ëµ£¬ÊµÏÖÉÏ¡¡

ÏÂÎIJ˵¥Ê±·¢Ë͵ÄÏûÏ¢Óë±ê×¼µÄ²Ëµ¥ÏûÏ¢²¢Ã»ÓÐʲôÁ½Ñù£¬ËüÃǶ¼·¢¡¡

ËÍON_MANDÏûÏ¢¡£µ«ÊÇ£¬ÓÉÓÚÉÏÏÂÎIJ˵¥µÄÌØÊâÐÔ£¬ÎÒÃÇÊ×ÏȱØÐë¡¡

±£Ö¤ÎÒÃÇÄܽÓÊÕµ½ÕâÑùµÄÏûÏ¢¡£Í¬Ê±£¬ÓÉÓÚÉÏÏÂÎIJ˵¥ÖÐûÓж¥²ã²Ë¡¡

µ¥£¬ÎÒÃǶÔËüÃǵĸú×ÙÓÐÒ»¶¨µÄÌØÊâÐÔ¡£ÎÒÃDzÉÓÃCMenuÀàµÄÒ»¸ö³É¡¡

Ô±º¯ÊýTrackPopupMenuÀ´ÊµÏÖ¡£¸Ãº¯ÊýµÄÔ­ÐÍΪ£º¡¡¡¡



BOOL¡¡TrackPopupMenu£¨UINT¡¡nFlags£»¡¡int¡¡x£»¡¡int¡¡y£»¡¡CWnd*¡¡pWnd£»¡¡LPCRECT¡¡lpRect¡¡=¡¡¡¡

NULL¡¡£©¡¡¡¡



¸Ãº¯ÊýÖУ¬²ÎÊýnFlagsÖ¸Ã÷ÆÁĻλÖÃÓëÊó±êλÖ÷ç¸ñ£¬x£»yΪһÒÀÀµ¡¡

ÓÚÇ°ÃæËùÖ¸¶¨·ç¸ñµÄÉÏÏÂÎIJ˵¥µÄÆÁĻλÖÃ×ø±ê£¬pWndΪһָÏòÓµÓС¡

¸Ã²Ëµ¥µÄ´°¿ÚÖ¸Õ룬¶ølpRectÖ¸Ã÷Óû§²»»á¶ªÊ§µôÉÏÏÂÎIJ˵¥µÄ¾ØÐΡ¡

Óò¡£²ÎÊýnFlags¿ÉÒÔÈ¡ÒÔÏÂÖµ£º¡¡¡¡



ÆÁĻλÖ÷ç¸ñ£ºTPM_CENTERALIGN£»TPM_LEFTALIGN£¬TPM_RIGHTALIGN¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡220¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

Êó±êλÖ÷ç¸ñ£ºTPM_LEFTBUTTON£¬TPM_RIGHTBUTTON¡¡¡¡



ÖÁÓÚ˵ËüÃǵÄÈ¡ÖµÊÇ¿ÉÒÔ»¥ÏàÈ¡¡¡¡°»ò¡±µÄ£¬¶øËüÃǵÄʵ¼ÊЧ¹û£¬ÎÒÃÇ¡¡

Ï£Íû¶ÁÕßͨ¹ýʵ¼ù¾ßÌå¿´¿´¡£ÏÂÃæµÄ³ÌÐò¶ÎÕª×ÔÀý³ÌÖÐÎļþ¡¡

CMenuView¡£cppÖУº¡¡¡¡



void¡¡CMenuView£º£ºOnRButtonDown£¨UINT¡¡nFlags£»¡¡CPoint¡¡point£©¡¡¡¡¡¡



£û¡¡¡¡



//¡¡TODO£º¡¡Add¡¡your¡¡message¡¡handler¡¡code¡¡here¡¡and/or¡¡call¡¡default¡¡¡¡



CMenu¡¡ContextMenu£»¡¡¡¡



if£¨£¡ContextMenu¡£LoadMenu£¨IDR_CONTEXTMENU£©£©¡¡¡¡



AfxThrowResourceException£¨£©£»¡¡¡¡



CMenu¡¡*pPopupMenu=ContextMenu¡£GetSubMenu£¨0£©£»¡¡¡¡



ASSERT£¨pPopupMenu£¡=NULL£©£»¡¡¡¡



ClientToScreen£¨&point£©£»¡¡¡¡



pPopupMenu¡­¡·TrackPopupMenu£¨TPM_LEFTALIGN£üTPM_RIGHTBUTTON£»¡¡¡¡



point¡£x£»point¡£y£»AfxGetMainWnd£¨£©£©£»¡¡¡¡



CView£º£ºOnRButtonDown£¨nFlags£»¡¡point£©£»¡¡¡¡



£ý¡¡¡¡



ÏÂÃæÎÒÃǶÔÕâÒ»¶Î´úÂë×÷¼òÒª·ÖÎö£º¡¡¡¡



³ÌÐòÖÐÏÈ×°Èë¸Ã²Ëµ¥¡¡£¨Ê¹ÓÃLoadMenu×°È룩£¬½ÓÏÂÀ´ÓÉÓÚÉÏÏÂÎIJ˵¥¡¡

µÄ¶¨Î»Ê¹ÓÃÆÁÄ»×ø±ê£¬ËùÒÔʹÓÃÁËÒ»¸öCWndÀàµÄ³ÉÔ±º¯Êý¡¡

ClientToScreen£¬È»ºóʹÓÃÁËTrackPopupMenu½«²Ëµ¥ÒÔÉÏÏÂÎÄ·½Ê½ÏÔ¡¡

ʾ£¬×îºó£¬³ÌÐòµ÷ÓÃCViewÀàµÄͨÓôúÂë´¦ÀíһЩƽ³£ÐÅÏ¢¡£¡¡¡¡



¡¡¡¡¡¡l¡¡×¢Ò⣺¡¡¡¡



¡¡¡¡¡¡l¡¡ÓÉÓڸú¯ÊýÔÚÀàCMenuViewÖÐʵÏÖ£¬ÔÚʹÓÃClassWizardʱÎñÇë×¢¡¡

¡¡¡¡¡¡¡¡¡¡Òâ»ùÀàµÄÑ¡Ôñ¡£È硡ͼ5¡£17Ëùʾ¡¡£¨Èç¹û´íÑ¡¡¡ÁËCMaimFrameÀ࣬³ÌÐò¡¡

¡¡¡¡¡¡¡¡¡¡×îºóËùµ÷ÓõĴ¦ÀíÀý³ÌΪCWndÀàµÄ´¦Àíº¯Êý£¬ÉÏÏÂÎIJ˵¥µÄÏÔʾ¡¡

¡¡¡¡¡¡¡¡¾Í³ÉÁËÎÊÌ⣩¡£¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡221¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Í¼5¡£¡¡17¡¡Ñ¡ÔñÉÏÏÂÎIJ˵¥ÊµÏֵĻùÀà¡¡¡¡



ÔÚ±¾ÕµÄ×îºó£¬ÎÒÃǸø³öÒ»²¿·Ö¹Ø¼üÐÔ´úÂ룬ÆäÖÐÊÖ¹¤¼ÓÈëµÄ²¿·ÖÒÔ¡¡

¾ßÓе×ÎƵÄÎÄ×Ö¸ø³ö¡¡£¨»ùÓÚ°æÃæ·½ÃæµÄ¿¼ÂÇ£¬ÎÒÃǶÔһЩÖظ´ÐԵĴú¡¡

ÂëÂÔÈ¥ÁË£©¡£¡¡¡¡



¡¡¡¡¡¡l¡¡×¢Ò⣺¡¡¡¡



¡¡¡¡¡¡l¡¡ÓÉÓڲ˵¥ÏîµÄÑ¡Ôñ±ê¼Ç¼°Ê¹ÄÜʵÏֽϼòµ¥£¬´Ë´¦Ê¡È¥Á˸ò¿·Ö¡£¡¡

¡¡¡¡¡¡¡¡µ«ÊµÏÖʱÐèµ÷ÓÃÏûÏ¢ÏìÓ¦WM_INITMENU¡£¡¡¡¡



¡¡¡¡¡¡l¡¡ÎªÁ˽Úʡƪ·ù£¬ÔÚ³ÌÐòÖÐÎÒÃÇûÓÐÔÚ´°¿Ú±ä»¯ºó½øÐÐÖػ棬Õⲿ¡¡

¡¡¡¡¡¡¡¡·ÖµÄÏêϸÄÚÈÝÇë²Î¼ûGDI»æͼһ½Ú¡£¡¡¡¡



//¡¡MainFrm¡£cpp¡¡£º¡¡ÀàCMainFrame¡¡µÄʵÏÖ¡¡¡¡



//¡¡¡¡



#include¡¡¡¨stdafx¡£h¡¨¡¡¡¡



//¡¡¡£¡£¡£¡¡¡¡



IMPLEMENT_DYNCREATE£¨CMainFrame£»¡¡CFrameWnd£©¡¡¡¡



BEGIN_MESSAGE_MAP£¨CMainFrame£»¡¡CFrameWnd£©¡¡¡¡



//£û£ûAFX_MSG_MAP£¨CMainFrame£©¡¡¡¡



ON_WM_CREATE£¨£©¡¡¡¡



ON_MAND£¨ID_VIEW_NORMALMENU£»¡¡OnViewNormalmenu£©¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡222¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

ON_MAND£¨ID_DRAW_LINE£»¡¡OnDrawLine£©¡¡¡¡



ON_MAND£¨ID_DRAW_CIRCLE£»¡¡OnDrawCircle£©¡¡¡¡



ON_MAND£¨ID_DRAW_RECTANGLE£»¡¡OnDrawRectangle£©¡¡¡¡



ON_MAND£¨ID_DYNCMODIFY_INSERT£»¡¡OnDyncmodifyInsert£©¡¡¡¡



ON_MAND£¨ID_HELP_INSERT£»¡¡OnHelpInsert£©¡¡¡¡



ON_MAND£¨ID_APP_EXIT£»¡¡OnAppExit£©¡¡¡¡



ON_MAND£¨ID_DYNCMODIFY_APPEND£»¡¡OnDyncmodifyAppend£©¡¡¡¡



ON_MAND£¨ID_HELP_APPEND£»¡¡OnHelpAppend£©¡¡¡¡



ON_MAND£¨ID_DYNCMODIFY_DELETE£»¡¡OnDyncmodifyDelete£©¡¡¡¡



ON_MAND£¨ID_DYNCMODIFY_MODIFY£»¡¡OnDyncmodifyModify£©¡¡¡¡



ON_MAND£¨ID_DYNCMODIFY_MODIFYSYSTEMMENU£»¡¡OnDyncmodifyModifysystemmenu£©¡¡¡¡



ON_MAND£¨ID_DYNCMODIFY_RESET£»¡¡OnDyncmodifyReset£©¡¡¡¡



ON_MAND£¨ID_CHANGE£»¡¡OnChange£©¡¡¡¡



ON_WM_SYSMAND£¨£©¡¡¡¡



//´Ë´¦ÎªÏµÍ³²Ëµ¥ÏûÏ¢ÏìÓ¦ÉùÃ÷£¬¸Ä±äϵͳ²Ëµ¥ºóµÄÏûÏ¢´¦Àí±ØÐëÉùÃ÷¸ÃÏìÓ¦¡¡¡¡



ON_MAND£¨ID_FILE_NEW£»¡¡OnFileNew£©¡¡¡¡



ON_MAND£¨ID_VIEW_LONGMENU£»¡¡OnViewLongmenu£©¡¡¡¡



//£ý£ýAFX_MSG_MAP¡¡¡¡



END_MESSAGE_MAP£¨¡¡£©¡¡¡¡



//ÒÔÉϺ¯ÊýÓ³É䲿·Ö½ö¹©¶ÁÕßÑ¡Óò˵¥IDʱ²Î¿¼¡£µ«ÊÇ£¬¡¡¡¡



//½«Õⲿ·Ö´úÂ
·µ»ØĿ¼ ÉÏÒ»Ò³ ÏÂÒ»Ò³ »Øµ½¶¥²¿ ÔÞ£¨1£© ²È£¨1£©
¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿!
ÎÂÜ°Ìáʾ£º ο´Ð¡ËµµÄͬʱ·¢±íÆÀÂÛ£¬Ëµ³ö×Ô¼ºµÄ¿´·¨ºÍÆäËüС»ï°éÃÇ·ÖÏíÒ²²»´íŶ£¡·¢±íÊéÆÀ»¹¿ÉÒÔ»ñµÃ»ý·ÖºÍ¾­Ñé½±Àø£¬ÈÏÕæдԭ´´ÊéÆÀ ±»²ÉÄÉΪ¾«ÆÀ¿ÉÒÔ»ñµÃ´óÁ¿½ð±Ò¡¢»ý·ÖºÍ¾­Ñé½±ÀøŶ£¡