ÓÑÇéÌáʾ£ºÈç¹û±¾ÍøÒ³´ò¿ªÌ«Âý»òÏÔʾ²»ÍêÕû£¬Çë³¢ÊÔÊó±êÓÒ¼ü¡°Ë¢Ð¡±±¾ÍøÒ³£¡
CÓïÑÔʵÀý½Ì³Ì(PDF¸ñʽ)-µÚ20²¿·Ö
¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿! Èç¹û±¾ÊéûÓÐÔĶÁÍ꣬ÏëÏ´μÌÐø½Ó×ÅÔĶÁ£¬¿ÉʹÓÃÉÏ·½ "Êղص½ÎÒµÄä¯ÀÀÆ÷" ¹¦ÄÜ ºÍ "¼ÓÈëÊéÇ©" ¹¦ÄÜ£¡
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ʱ²Î¿¼¡£µ«ÊÇ£¬¡¡¡¡
//½«Õⲿ·Ö´úÂëÓëʵÏÖϵͳ²Ëµ¥Ê±µÄÏûÏ¢Ó³Éä×÷Ò»¶Ô±ÈÊÇÓÐÒâÒåµÄ¡£¡¡¡¡
static¡¡UINT¡¡indicators£§£§¡¡=¡¡¡¡
£û¡¡¡¡
ID_SEPARATOR£»¡¡//¡¡status¡¡line¡¡indicator¡¡¡¡
ID_INDICATOR_CAPS£»¡¡¡¡
ID_INDICATOR_NUM£»¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡223¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ID_INDICATOR_SCRL£»¡¡¡¡
£ý£»¡¡¡¡¡¡
//´Ë´¦Îª×´Ì¬À¸ÉϵķÖÅ䣬¾ßÌåÎÒÃÇÔÚºóÃæ»áÓÐÌá¼°¡£¡¡¡¡
/////////////////////////////////////////////////////////////////////////////¡¡¡¡
//¡¡CMainFrame¡¡construction/destruction¡¡¡¡
CMainFrame£º£ºCMainFrame£¨£©¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡add¡¡member¡¡initialization¡¡code¡¡here¡¡¡¡
bInsert=TRUE£»//·ÀÖ¹²Ëµ¥±»Öظ´²åÈëµÄ¿ØÖƱäÁ¿¡¡¡¡
bAppend=TRUE£»//·ÀÖ¹²Ëµ¥±»Öظ´¼ÓÈëµÄ¿ØÖƱäÁ¿¡¡¡¡
bDelete=TRUE£»//·ÀÖ¹²Ëµ¥±»Öظ´É¾³ýµÄ¿ØÖƱäÁ¿¡¡¡¡
bModify=TRUE£»//·ÀÖ¹²Ëµ¥±»Öظ´Ð޸ĵĿØÖƱäÁ¿¡¡¡¡
bBitmap=FALSE£»//±êʶÊÇ·ñʹÓÃÁËͼ·û²Ëµ¥¡¡¡¡
£ý¡¡¡¡
//ÔÚCMainFrameÀàµÄ¹¹Ô캯ÊýÖУ¬ÎÒÃǼÓÈëÁËÒ»²¿·ÖÖ§³Ö²Ëµ¥¶¯Ì¬¡¡¡¡
//´¦Àí¿ØÖƵÄBOOLÐͱäÁ¿£¬ËüÃǵĶ¨ÒåÔÚº¯ÊýCMainFrame¡£hÖС¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
int¡¡CMainFrame£º£ºOnCreate£¨LPCREATESTRUCT¡¡lpCreateStruct£©¡¡¡¡
£û¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
//¡¡Ìáʾ£º¡¡ÒÔϲ¿·Ö´úÂëÓÃÓÚ¿ØÖƹ¤¾ßÌõÌáʾ¼°¹¤¾ßÌõ±¾ÉíʵÏÖ£¬¡¡¡¡
//Èç¹û²»ÐèÒª¿ÉÒÔ½«ÏÂÃæÁ½ÐдúÂëÒÆÈ¥¡¡¡¡
m_wndToolBar¡£SetBarStyle£¨m_wndToolBar¡£GetBarStyle£¨£©¡¡£ü¡¡¡¡
CBRS_TOOLTIPS¡¡£ü¡¡CBRS_FLYBY¡¡£ü¡¡CBRS_SIZE_DYNAMIC£©£»¡¡¡¡
//Ìáʾ£ºÏÂÃæÈýÐдúÂë¿ØÖƹ¤¾ßÌõÊÇ·ñ¿ÉÒÔÒƶ¯£¬Èç¹ûÄã²¢²»¡¡¡¡
//Ï£Íû¹¤¾ßÌõ¿ÉÒÔÔÚÆÁÄ»ÄÚÒƶ¯£¬¿ÉÒÔɾȥËüÃÇ¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡224¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
m_wndToolBar¡£EnableDocking£¨CBRS_ALIGN_ANY£©£»¡¡¡¡
EnableDocking£¨CBRS_ALIGN_ANY£©£»¡¡¡¡
DockControlBar£¨&m_wndToolBar£©£»¡¡¡¡
hLongMenu¡£LoadMenu£¨IDR_MAINFRAME1£©£»¡¡¡¡
hNormalMenu¡£LoadMenu£¨IDR_MAINFRAME0£©£»¡¡¡¡
hLine¡£LoadBitmap£¨IDB_LINE£©£»¡¡¡¡
hCircle¡£LoadBitmap£¨IDB_CIRCLE£©£»¡¡¡¡
hRectangle¡£LoadBitmap£¨IDB_RECTANGLE£©£»¡¡¡¡
hText¡£LoadBitmap£¨IDB_TEXT£©£»¡¡¡¡
//ÒÔÉϼ¸ÐдúÂë×°Èë×ÊÔ´¡¡£¨²Ëµ¥£¬Î»Í¼£©£¬µ«ÓÉÓÚÉÏÏÂÎIJ˵¥¡¡¡¡
//´¦Àí»úÖƲ»Ò»Ñù£¬Æä×ÊÔ´²¢²»ÔÚ´Ë´¦×°Èë¡£¡¡¡¡
return¡¡0£»¡¡¡¡
£ý¡¡¡¡
//ÒÔÉÏÊ¡ÂÔ´úÂëÓÃÓÚµ÷ÊÔ£¬ÔÚ³ÌÐòµÄ·¢ÐаæÖн«±»ÒÆÈ¥¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
/////////////////////////////////////////////////////////////////////////////¡¡¡¡
//¡¡CMainFrame¡¡message¡¡handlers¡¡¡¡
void¡¡CMainFrame£º£ºOnViewLongmenu£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
SetMenu£¨&hLongMenu£©£»¡¡¡¡
hLongMenu¡£Detach£¨£©£»¡¡¡¡
//ÒÔÉϲ¿·Ö´úÂëÓÃÓÚʵÏÖÖÁ³¤²Ëµ¥µÄÇл»¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnViewNormalmenu£¨£©¡¡¡¡¡¡
£û¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡225¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
SetMenu£¨&hNormalMenu£©£»¡¡¡¡
hNormalMenu¡£Detach£¨£©£»¡¡¡¡
//ÒÔÉϲ¿·Ö´úÂëÓÃÓÚʵÏÖÖÁÆÕͨ²Ëµ¥µÄÇл»¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnDrawLine£¨£©¡¡¡¡¡¡
£û¡¡¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
CClientDC¡¡ClientDC£¨this£©£»//´´½¨Ò»¿Í»§ÇøÉ豸¶ÔÏó¡¡¡¡
ClientDC¡£MoveTo£¨120£»120£©£»//Òƶ¯¶ÔÏóÆðµãÖÁ¡¡£¨120£¬120£©¡¡¡¡
ClientDC¡£LineTo£¨260£»260£©£»//×Ô¡¡£¨120£¬120£©ÖÁ¡¡£¨260£¬260£©»Ö±Ïß¡¡¡¡
//ÒÔÉϲ¿·Ö´úÂëÓÃÓÚÔÚ³ÌÐòÖ÷´°¿ÚÖÐ×÷Ò»Æðµã¡¡¡¡
//Ϊ¡¡£¨120£¬120£©£¬ÖÕµãΪ¡¡£¨260£¬260£©µÄÖ±Ïß¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnDrawCircle£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
CClientDC¡¡ClientDC£¨this£©£»¡¡¡¡
ClientDC¡£Arc£¨80£»40£»160£»120£»80£»80£»80£»80£©£»¡¡¡¡
//ÒÔÉÏ´úÂ벿·ÖÓÃÓÚÔÚÆÁÄ»ÄÚ»Ô²£¬»ù±¾Í¬ÉÏ£¬Ö»ÊÇ×îºó×÷ͼµ÷Óú¯ÊýArc¡¡¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnDrawRectangle£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
CClientDC¡¡ClientDC£¨this£©£»¡¡¡¡
ClientDC¡£MoveTo£¨120£»120£©£»¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡226¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ClientDC¡£LineTo£¨170£»120£©£»¡¡¡¡
ClientDC¡£LineTo£¨170£»150£©£»¡¡¡¡
ClientDC¡£LineTo£¨120£»150£©£»¡¡¡¡
ClientDC¡£LineTo£¨120£»120£©£»¡¡¡¡
//»ù±¾½âÊÍͬÉÏ£¬Ê¹ÓÃÉ豸¶ÔÏó»¾ØÐΡ¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnDyncmodifyInsert£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
if£¨bInsert£©//¿ØÖÆÖظ´¼ÓÈë±äÁ¿ÎªÕæʱÔÊÐí¼ÓÈë¡¡¡¡
£û¡¡¡¡
CMenu¡¡*pMenu=GetMenu£¨¡¡£©£»//È¡µÃ³ÌÐòÖ÷²Ëµ¥Ö¸Õë¡¡¡¡
CMenu¡¡*pSubMenu=pMenu¡¡·GetSubMenu£¨3£©£»¡¡¡¡
//º¯ÊýGetSubMenu£¨£©ÓÃÓÚ´Ó0»ùÈ¡µÃ²Ëµ¥ÏîÖ¸Õë¡¡¡¡
pSubMenu¡¡·InsertMenu£¨ID_APP_ABOUT£»¡¡¡¡
MF_BYMAND£»ID_HELP_INSERT£»¡¨&I'm¡¡inserted¡¡here£¡¡¨£©£»¡¡¡¡
bInsert=FALSE£»¡¡¡¡
£ý¡¡¡¡
//ÒÔÉϲ¿·Ö´úÂëÓÃÓÚÔÚHELP²Ëµ¥ÖÐAbout¡¡£ÏîÇ°¡¡¡¡
//¼ÓÈëһв˵¥¡±I¡¯m¡¡inserted¡¡here£¡¡±¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnHelpInsert£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
MessageBox£¨¡¨I'm¡¡inserted¡¡in¡¡the¡¡help¡¡menu£¡¡¨£©£»¡¡¡¡
//ÏÔʾһ±ê×¼ÏûÏ¢¿ò£¬µ±È»£¬´Ë´¦¶Ô¼ÓÈë²Ëµ¥µÄÏìÓ¦½Ï¼òµ¥£¬¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡227¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
//½ö½öÊÇΪÁË˵Ã÷ÎÊÌâ¶øÒÑ£»ÔÚºóÃæµÄº¯ÊýʵÏÖÖÐÎÒÃÇ×ñÑͬÑùµÄÔÔò£¬¡¡¡¡
//¶ÁÕßÈç¹ûÓÐÐËȤ£¬¾¡¿ÉÒÔÒÔ×Ô¼º±àдµÄº¯ÊýÏìÓ¦´úÌæÖ®¡¡¡¡
//ÒÔÉÏΪмÓÈë²Ëµ¥µÄÏìÓ¦º¯Êý£¬Çë¶ÁÕß¡¡¡¡
//×¢ÒâÇ°ÃæËù½²µÄ¼ÓÈë¸ÃÏìÓ¦º¯ÊýµÄ·½·¨¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnAppExit£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
MessageBox£¨¡¨Thank¡¡you¡¡for¡¡using¡¡this¡¡programe£¡¡¨£©£»¡¡¡¡
PostMessage£¨WM_CLOSE£©£»//·¢ËͳÌÐòÍ˳öÏûÏ¢¡¡¡¡
//ÎÒÃǶԳÌÐòÍ˳ö½øÐпØÖÆ£¬ÓÉÓÚ³ÌÐòÍ˳ö×Ü»á²úÉú¶Ô¸Ãº¯ÊýµÄµ÷Ó㬡¡¡¡
//ÔÚÕâÀÎÒÃÇÁ¦Í¼Ê¹ÎÒÃǵijÌÐòÏÔµÃÓÐÀñòЩ£¬ÕâÒ»²¿·Ö¶ÁÕßÒ²¿ÉÒÔ¡¡¡¡
//¸Äд֮ÒÔʵÏÖ×Ô¼ºËùÆÚÍûµÄ¹¦ÄÜ¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnDyncmodifyAppend£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
if£¨bAppend£©//¶¯Ì¬¼Ó²Ëµ¥ÏîÖÁ²Ëµ¥Ä©Î²BOOLÐÍ¿ØÖƱäÁ¿¡¡¡¡
£û¡¡¡¡
CMenu¡¡*pMenu=GetMenu£¨£©£»¡¡¡¡
CMenu¡¡*pSubMenu=pMenu¡¡·GetSubMenu£¨3£©£»¡¡¡¡
pSubMenu¡¡·AppendMenu£¨MF_STRING£»ID_HELP_APPEND£»¡¨&I'm¡¡appended¡¡here£¡¡¨£©£»¡¡¡¡
bAppend=FALSE£»¡¡¡¡
£ý¡¡¡¡
//ÒÔÉϲ¿·Ö´úÂëÔÚHelp²Ëµ¥µÄ×îĩβ¼ÓÈëÒ»²Ëµ¥ÏI¡¯m¡¡appended¡¡here£¡¡±¡¡¡¡
£ý¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡228¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
void¡¡CMainFrame£º£ºOnHelpAppend£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
MessageBox£¨¡¨I'm¡¡appended¡¡in¡¡the¡¡help¡¡menu£¡¡¨£©£»¡¡¡¡
//²Ëµ¥ÏI¡¯m¡¡appended¡¡here£¡¡±µÄÏûÏ¢ÏìÓ¦º¯Êý¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnDyncmodifyDelete£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
if£¨bDelete£©//¶¯Ì¬É¾³ý²Ëµ¥ÏîBOOLÐÍ¿ØÖƱäÁ¿¡¡¡¡
£û¡¡¡¡
CMenu¡¡*pMenu=GetMenu£¨£©£»¡¡¡¡
CMenu¡¡*pSubMenu=pMenu¡¡·GetSubMenu£¨0£©£»¡¡¡¡
pSubMenu¡¡·DeleteMenu£¨5£»MF_BYPOSITION£©£»¡¡¡¡
//ÕâÀïÎÒÃDzÉÓÃÓÃλÖöԲ˵¥Ïλ£¬×¢Òâ²Ëµ¥ÏîÊÇ0»ùµÄ¡¡¡¡
//×¢Ò⣺²Ëµ¥Ïî·Ö¸ôÏßÒ²ÊDz˵¥Ïî¡¡¡¡
bDelete=FALSE£»¡¡¡¡
£ý¡¡¡¡
//ÒÔÉϲ¿·Ö´úÂëɾ³ýFileÖеÚÁù¸ö²Ëµ¥Ïî¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnDyncmodifyModify£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
if£¨bModify£©//¶¯Ì¬Ð޸IJ˵¥ÏîBOOLÐÍ¿ØÖƱäÁ¿¡¡¡¡
£û¡¡¡¡
CMenu¡¡*pMenu=GetMenu£¨£©£»¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡229¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
CMenu¡¡*pSubMenu=pMenu¡¡·GetSubMenu£¨3£©£»¡¡¡¡
pSubMenu¡¡·ModifyMenu£¨ID_APP_ABOUT£»¡¡¡¡
MF_BYMAND£»ID_APP_ABOUT£»¡¨&Version¡¡information£¡¡¨£©£»¡¡¡¡
bModify=FALSE£»¡¡¡¡
£ý¡¡¡¡
//¶¯Ì¬µÄ¸Ä±äHelp²Ëµ¥ÖÐÏÔʾ³ÌÐò°æ±¾ÐÅÏ¢¶Ô»°¿òµÄ²Ëµ¥Îı¾¡¡¡¡
//£¨ÕâÖָıäºó²Ëµ¥ÏîÊDz»ÊǸüÄܽÏÌùÇеķ´Ó¦²Ëµ¥ÏîÕæʵÄÚÈÝ£©£¿¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnDyncmodifyModifysystemmenu£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
CMenu¡¡*pSystemMenu=GetSystemMenu£¨FALSE£©£»¡¡¡¡
//ÒÔFALSEµ÷ÓÃϵͳ²Ëµ¥£¬ÒÔ±ã¶ÔÆä½øÐÐÐ޸ģ¬¡¡¡¡
//µ«Çë×¢ÒâÆäÏûÏ¢ÏìÓ¦º¯ÊýµÄÌØÊâÐÔ¡¡¡¡
pSystemMenu¡¡·ModifyMenu£¨1£»MF_BYPOSITION£»ID_FILE_NEW£»¡¨&I'll¡¡draw¡¡a¡¡rectangle£¡¡¨£©£»¡¡¡¡
//¸Ä±äϵͳ²Ëµ¥ÖС¡¡°Òƶ¯¡±²Ëµ¥ÏÒÔʵÏÖÔÚ³ÌÐò´°¿ÚÖлһ¾ØÐΡ¡¡¡
//ÒÔÉÏ´úÂëÐÞ¸ÄÁËϵͳ²Ëµ¥¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnDyncmodifyReset£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
CMenu¡¡*pSystemMenu=GetSystemMenu£¨TRUE£©£»¡¡¡¡
//ÒÔÉϲ¿·ÖÒÔTRUEΪ²ÎÊýµ÷ÓÃϵͳ²Ëµ¥£¬ÊµÏÖÁËϵͳ²Ëµ¥µÄ¸´Ô¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnChange£¨£©¡¡¡¡¡¡
£û¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡230¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
if£¨£¡bBitmap£©//¿ØÖÆʹÓúÎÖֲ˵¥µÄ±äÁ¿¡¡¡¡
£û¡¡¡¡
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£©£»¡¡¡¡
£ý¡¡¡¡
//ÒÔÉϲ¿·Ö·Ö±ðÒÔλͼ¶ÔÏóÖ¸Õë×÷ModifyMenu£¨¡¡£©º¯ÊýµÄ×îºóÒ»¸ö²ÎÊý£¬¡¡¡¡
//½«²Ëµ¥»»ÎªÁËͼ·û²Ëµ¥¡¡¡¡
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¡¨£©£»¡¡¡¡
£ý¡¡¡¡
//ÒÔÉϲ¿·Ö·Ö±ðÒÔÏàÓ¦Îı¾¶ÔÏóÖ¸Õë×÷ModifyMenu£¨¡¡£©º¯ÊýµÄ×îºóÒ»¸ö²ÎÊý£¬¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡231¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
//½«²Ëµ¥»»ÎªÁËÎı¾²Ëµ¥¡¡¡¡
//ÒÔÉϲ¿·Ö´úÂëʵÏÖDrawµÄͼ·û²Ëµ¥ÓëÎı¾²Ëµ¥µÄÇл»¡¡¡¡
£ý¡¡¡¡
¡¡¡¡¡¡¡¡
//×¢ÒâÏÂÃæÕâÒ»²¿·Ö´úÂ룬ϵͳ²Ëµ¥µÄÏûÏ¢ÏìÓ¦×ÜÊǵ÷Óú¯Êý¡¡¡¡
//OnSysmand£¨¡¡£©£¬Í¬Ê±×¢Òâ¸Ãº¯ÊýµÄÓ³Éä½Ó¿ÚµÄÌØÊâÐÔ¡¡¡¡
//ϵͳ²Ëµ¥·¢Ë͵ÄÏûϢΪWM_SYSMAND£»¶øÆÕͨµÄ²Ëµ¥¡¡¡¡
//·¢ËÍÏûÏ¢WM_MAND£¬ÕâÒ»µãͨ¹ýSpy£«£«¹¤¾ß¿ÉÒԺܡ¡¡¡
//Ã÷ÏԵĿ´³ö¡¡¡¡
void¡¡CMainFrame£º£ºOnSysmand£¨UINT¡¡nID£»¡¡LPARAM¡¡lParam£©¡¡¡¡
£û¡¡¡¡
if¡¡£¨£¨nID&0xFFF0£©==ID_FILE_NEW£©¡¡¡¡
//ÔÚÏûÏ¢WM_SYSMANDÖУ»²ÎÊýnIDµÄµÍËÄλΪ¡¡¡¡
//WindowsϵͳÄÚ²¿Ê¹Óã¬ÔÚÓ¦ÓóÌÐòʹÓÃÆäֵʱ£¬¡¡¡¡
//Ó¦Óë0Xfff0ÇóÓëºóʹÓ÷½Äܵõ½ÕýÈ·½á¹û¡£¡¡¡¡
£û¡¡¡¡
CMainFrame£º£ºOnFileNew£¨£©£»¡¡¡¡
£ý¡¡¡¡
//´Ë´¦²úÉúÕý³£µ÷Óã¬ÔÚÓ¦ÓóÌÐòûÓÐÉæ¼°µÄÏûÏ¢Ó³É䣬¡¡¡¡
//Ó¦µ÷ÓÃϵͳ±ê×¼µ÷Óô¦Àí¡¡¡¡
else¡¡¡¡
£û¡¡¡¡
CFrameWnd£º£ºOnSysmand£¨nID£»¡¡lParam£©£»¡¡¡¡
£ý¡¡¡¡
//ÒÔÉϲ¿·Ö´úÂë¸Ä±äÁËϵͳȱʡ²Ëµ¥µÄÐÐΪ£¬µ±È»£¬¶ÁÕ߶ԡ¡¡¡
//ϵͳ²Ëµ¥µÄ¸Ä±ä¿ÉÄܸü¾ß´´ÔìÐÔ¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡232¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
£ý¡¡¡¡
void¡¡CMainFrame£º£ºOnFileNew£¨£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡mand¡¡handler¡¡code¡¡here¡¡¡¡
CMainFrame£º£ºOnDrawRectangle£¨£©£»¡¡¡¡
MessageBox£¨¡¨I've¡¡drawn¡¡a¡¡rectangle£¡¡¨£©£»¡¡¡¡
//ϵͳ²Ëµ¥ÖеÄÒ»¸öÏûÏ¢ÏìÓ¦º¯Êý£¬ËüµÄ±àдûÓÐʲôÌØÊâÖ®´¦¡¡¡¡
£ý¡¡¡¡
//ÒÔÏÂΪº¯ÊýMenuView¡£cppµÄ´úÂë¡¡¡¡
//¡¡MenuView¡£cpp¡¡£ºÀàCMenuViewµÄʵÏÖ¡¡¡¡
//¡¡¡¡
#include¡¡¡¨stdafx¡£h¡¨¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
/////////////////////////////////////////////////////////////////////////////¡¡¡¡
//¡¡CMenuView¡¡¡¡
IMPLEMENT_DYNCREATE£¨CMenuView£»¡¡CView£©¡¡¡¡
BEGIN_MESSAGE_MAP£¨CMenuView£»¡¡CView£©¡¡¡¡
//£û£ûAFX_MSG_MAP£¨CMenuView£©¡¡¡¡
ON_WM_RBUTTONDOWN£¨£©¡¡¡¡
//£ý£ýAFX_MSG_MAP¡¡¡¡
END_MESSAGE_MAP£¨£©¡¡¡¡
//ÒÔÉÏΪÏûÏ¢ÏìÓ¦ÈË¿Ú¡¡¡¡
/////////////////////////////////////////////////////////////////////////////¡¡¡¡
//¡¡CMenuView¡¡construction/destruction¡¡¡¡
CMenuView£º£ºCMenuView£¨£©¡¡¡¡
£û¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡233¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
//¡¡TODO£º¡¡add¡¡construction¡¡code¡¡here¡¡¡¡
//CMenuViewÀ๹Ô캯Êý£¬ÔÚÎĵµ/ÊÓÒ»ÕÂÖÐÎÒÃǽ«¶Ô´Ë×÷ÏêϸµÄ½âÊÍ¡¡¡¡
£ý¡¡¡¡
CMenuView£º£º~CMenuView£¨£©¡¡¡¡
£û¡¡¡¡
//CMenuViewÀàÎö¹¹º¯Êý£¬ÔÚÎĵµ/ÊÓÒ»ÕÂÖÐÎÒÃǽ«¶Ô´Ë×÷ÏêϸµÄ½âÊÍ¡¡¡¡
£ý¡¡¡¡
BOOL¡¡CMenuView£º£ºPreCreateWindow£¨CREATESTRUCT&¡¡cs£©¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Modify¡¡the¡¡Window¡¡class¡¡or¡¡styles¡¡here¡¡by¡¡modifying¡¡¡¡
//¡¡the¡¡CREATESTRUCT¡¡cs¡¡¡¡
//ÔÚ´Ë´¦¿ÉÒԸı䴰¿ÚµÄʵÏÖ¡¡¡¡
return¡¡CView£º£ºPreCreateWindow£¨cs£©£»¡¡¡¡
£ý¡¡¡¡
/////////////////////////////////////////////////////////////////////////////¡¡¡¡
//¡¡CMenuView¡¡drawing¡¡¡¡
void¡¡CMenuView£º£ºOnDraw£¨CDC*¡¡pDC£©¡¡¡¡
£û¡¡¡¡
CMenuDoc*¡¡pDoc¡¡=¡¡GetDocument£¨£©£»¡¡¡¡
ASSERT_VALID£¨pDoc£©£»¡¡¡¡
//Îĵµ»æͼµ÷Óú¯Êý¡¡¡¡
//¡¡TODO£º¡¡add¡¡draw¡¡code¡¡for¡¡native¡¡data¡¡here¡¡¡¡
£ý¡¡¡¡
//¡¡CMenuView¡¡diagnostics¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
//ÒÔÉϲ¿·ÖΪµ÷ÊÔ´úÂëʱÓã¬ÔÚ³ÌÐòµÄ·¢ÐаæÖн«±»ÒÆÈ¥¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡234¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
CMenuDoc*¡¡CMenuView£º£ºGetDocument£¨¡¡£©¡¡//¡¡¸Ãº¯Êý·Çµ÷ÊÔʱΪÄÚÁªº¯Êý¡¡¡¡
£û¡¡¡¡
ASSERT£¨m_pDocument¡¡·IsKindOf£¨RUNTIME_CLASS£¨CMenuDoc£©£©£©£»¡¡¡¡
return¡¡£¨CMenuDoc*£©m_pDocument£»¡¡¡¡
£ý¡¡¡¡
//»ñµÃÎĵµÖ¸Õë¡¡¡¡
#endif¡¡//_DEBUG¡¡¡¡
/////////////////////////////////////////////////////////////////////////////¡¡¡¡
//¡¡ÒÔÏÂΪCMenuView¡¡ÀàÏûÏ¢´¦Àíº¯Êý¡¡¡¡
//ÏÂÃæµÄ´úÂë´¦ÀíÁËÓÒ»÷Êó±êʱÉÏÏÂÎIJ˵¥µÄ´¦Àí£¬µ±È»£¬ÄãÒ²¡¡¡¡
//¿ÉÒÔ¸ÄÔÚ±ðµÄÊó±êʼþʱʹÓÃÉÏÏÂÎIJ˵¥¡¡¡¡
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£¨£©£»¡¡¡¡
//×°ÈëÉÏÏÂÎIJ˵¥×ÊÔ´£¬×°Èëʧ°Üʱµ÷ÓÃÒì³£´¦Àíº¯Êý¡¡¡¡
CMenu¡¡*pPopupMenu=ContextMenu¡£GetSubMenu£¨0£©£»¡¡¡¡
ASSERT£¨pPopupMenu£¡=NULL£©£»//ʹÓöÏÑÔ£¬·½±ãµ÷ÊÔ¡¡¡¡
ClientToScreen£¨&point£©£»//ת»»¿Í»§Çø×ø±êÖÁÆÁÄ»×ø±ê¡¡¡¡
pPopupMenu¡¡·TrackPopupMenu£¨TPM_LEFTALIGN£üTPM_RIGHTBUTTON£»¡¡¡¡
point¡£x£»point¡£y£»AfxGetMainWnd£¨£©£©£»//½«²Ëµ¥×÷ΪÉÏÏÂÎIJ˵¥ÏÔʾ¡¡¡¡
CView£º£ºOnRButtonDown£¨nFlags£»¡¡point£©£»¡¡¡¡
£ý¡¡¡¡
//ÒÔÉϲ¿·ÖΪÉÏÏÂÎIJ˵¥µÄ´¦Àíº¯Êý¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡235¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
//ÒÔϲ¿·Ö´úÂëÕª×ÔMainFrm¡£hÖС¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
//¡¡Attributes¡¡¡¡
public£º¡¡¡¡
BOOL¡¡bInsert£»¡¡¡¡
BOOL¡¡bAppend£»¡¡¡¡
BOOL¡¡bDelete£»¡¡¡¡
BOOL¡¡bModify£»¡¡¡¡
BOOL¡¡bBitmap£»¡¡¡¡
//ÒÔÉϲ¿·Ö´úÂëΪ¿ØÖƱäÁ¿¡¡¡¡
CMenu¡¡hLongMenu£»¡¡¡¡
CMenu¡¡hNormalMenu£»¡¡¡¡
//ÒÔÉϲ¿·ÖΪ²Ëµ¥×ÊÔ´¶ÔÏó¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡µÚ¶þ½Ú¡¡¹¤¾ßÌõ¡¡¡¡
Ê×ÏÈÈÃÎÒÃÇ´ÓMFC¿ØÖÆÌõ̸Æ𡣡¡¡¡
MFCµÄ¹¤¾ßÌõÀàCToolBarÊǼ¸ÖÖ¿É´´½¨ÓÃÀ´½ÓÊÕijЩÃüÁîÊäÈë²¢ÏòÓá¡
»§ÏÔʾ״̬ÏûÏ¢µÄÀàÖеÄÒ»Óû§¿ÉÒÔÓù¤¾ßÌõÀ´Á¢¼´·ÃÎʳÌÐòÃüÁî¡£¡¡
¹¤¾ßÌõÊÇÖ±½Ó¿ÉÒÔ¿´µ½µÄ£¬¶ø²»ÊÇÏó²Ëµ¥ÄÇÑùÐèÒªÒ»²ãÒ»²ãµÄÉîÈ룬¡¡
»òÏó¼üÅÌÄÇÑùÐèÒª¼ÇÒä¡£ÓÉÓÚËüÕ¼ÓÃÆÁÄ»¿Õ¼ä£¬Òò´ËÒ»¶¨ÒªÈ·±£ÄãµÄ¡¡
¹¤¾ßÌõ°üÀ¨µÄÊÇ×î¾³£Ê¹ÓõÄÃüÁî¡£´óÐͳÌÐòͨ³£Óжà¸ö¹¤¾ßÌõÀ´Îª¡¡
²»Í¬µÄÓû§ÈÎÎñ·þÎñ¡£¼´Ê¹Ä
¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿!
ÎÂÜ°Ìáʾ£º ο´Ð¡ËµµÄͬʱ·¢±íÆÀÂÛ£¬Ëµ³ö×Ô¼ºµÄ¿´·¨ºÍÆäËüС»ï°éÃÇ·ÖÏíÒ²²»´íŶ£¡·¢±íÊéÆÀ»¹¿ÉÒÔ»ñµÃ»ý·ÖºÍ¾Ñé½±Àø£¬ÈÏÕæдԴ´ÊéÆÀ ±»²ÉÄÉΪ¾«ÆÀ¿ÉÒÔ»ñµÃ´óÁ¿½ð±Ò¡¢»ý·ÖºÍ¾Ñé½±ÀøŶ£¡