ÓÑÇéÌáʾ£ºÈç¹û±¾ÍøÒ³´ò¿ªÌ«Âý»òÏÔʾ²»ÍêÕû£¬Çë³¢ÊÔÊó±êÓÒ¼ü¡°Ë¢Ð¡±±¾ÍøÒ³£¡
CÓïÑÔʵÀý½Ì³Ì(PDF¸ñʽ)-µÚ43²¿·Ö
¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿! Èç¹û±¾ÊéûÓÐÔĶÁÍ꣬ÏëÏ´μÌÐø½Ó×ÅÔĶÁ£¬¿ÉʹÓÃÉÏ·½ "Êղص½ÎÒµÄä¯ÀÀÆ÷" ¹¦ÄÜ ºÍ "¼ÓÈëÊéÇ©" ¹¦ÄÜ£¡
RUNTIME_CLASS£¨CMdiView£©£©£»¡¡¡¡
AddDocTemplate£¨pDocTemplate£©£»¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
return¡¡TRUE£»¡¡¡¡
£ý¡¡¡¡
ÿ´Î´ò¿ªÒ»¸öÐÂÎĵµÊ±¶¼µ÷ÓÃCDocumentµÄº¯ÊýOnNewDocument¡£¸Ãº¯¡¡
Êý±»¶¨ÒåÈçÏ£º¡¡¡¡
class¡¡CMdiDoc¡¡£º¡¡public¡¡CDocument¡¡¡¡
£û¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
//¡¡Overrides¡¡¡¡
//¡¡ClassWizard¡¡generated¡¡virtual¡¡function¡¡overrides¡¡¡¡
//£û£ûAFX_VIRTUAL£¨CMdiDoc£©¡¡¡¡
public£º¡¡¡¡
virtual¡¡BOOL¡¡OnNewDocument£¨£©£»¡¡¡¡
virtual¡¡void¡¡Serialize£¨CArchive&¡¡ar£©£»¡¡¡¡
//£ý£ýAFX_VIRTUAL¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
£ý¡¡¡¡
µ±µ÷Óô˺¯Êýʱ¿ÉÒԵõ½Ò»¸öеÄMDI×Ó´°¿Ú£¬ËüÓÉCDMIChildWndÅÉ¡¡
Éú³öÀ´¡£ÕâЩ×Ó´°¿Ú±£´æן÷ÖÖÒÑ´ò¿ªµÄÎĵµ£¬ËùÓеÄϸ½Ú¶¼ÊÇÓÉ¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡499¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
MFC¿â´¦Àí¡£¶øÿ¸öMDI×Ó´°¿Ú¶¼Ö§³ÖÓÉÀàCViewÅÉÉú³öµÄÆÕͨÀàÐ͵ġ¡
ÊÓ´°¡£¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÕâÒâζ×Å¿ÉÒÔͬÒÔÇ°Ò»Ñù²»ÊÜÔ¼ÊøµØʹÓÃWM_CHARºÍ¡¡
WM_MOUSEMOVEÕâÀàÏûÏ¢¡£¡¡¡¡
¡¡¡¡l¡¡×¢Ò⣺¡¡¡¡
¡¡¡¡l¡¡Èç¹û¶ÁÕ߶ÔÕâÒ»²¿·ÖµÄÀí½â²»Ì«Çå³þ£¬½¨ÒéÔÙ¿´¿´6¡£5ÊÓÀàÒ»½Ú¡¡
¡¡¡¡¡¡ÖÐÓйØÊÓÀà²ã´Î½á¹¹µÄ½éÉÜ¡£¡¡¡¡
ÔÚ8¡£4Éú³ÉÊÓÒ»½ÚÖеÄ×îºó£¬ÎÒÃÇÔø¾Ìáµ½¹ý£¬¿ÉÒÔÓõ÷Óú¯Êý¡¡
UpdateAllViewsÀ´Î¬»¤ËùÐèÒªµÄÖÚ¶àÊÓ´°µÄͬʱе÷¹¤×÷¡£µ±ÈÎÒâÒ»¡¡
¸öÊÓ´°ÐÞ¸ÄÁËÎĵµÖ®ºó¾Í¿Éµ÷Óøú¯Êý£¬ÕâÑù¿ÉÈ·±£³ýÁ˵ÚÒ»¸öµ÷Óá¡
¸Ãº¯Êý½øÐÐÐ޸ĵÄÊÓ´°ÍâËùÓÐÊÓ´°¾ùµ÷Óú¯ÊýOnUpdate¡£ÔÚÇ°ÃæµÄÄÇ¡¡
¸öÀý×ÓÖУ¬ÎÒÃǾÍÈçÉÏËùÊöµÄµ÷ÓÃÁ˸ÃÀà¡£¡¡¡¡
º¯ÊýUpdateAllViews¡¡µÄÔÐÍΪ£º¡¡¡¡
void¡¡UpdateAllViews£¨¡¡CView*¡¡pSender£»¡¡LPARAM¡¡lHint¡¡=¡¡0L£»¡¡CObject*¡¡pHint¡¡=¡¡NULL¡¡£©£»¡¡¡¡
ÆäÖÐLONGÐͲÎÊýlHintͨ³£Ëù°üº¬µÄÐÅÏ¢ÓëÊÓ´°¶ÔÎĵµËù×öµÄÐÞ¸ÄÓС¡
¹Ø£»pHint×ÜÊÇÖ¸ÏòÒ»¸ö¶ÔÏ󣬸öÔÏóÓÐÖúÓÚ´¦Àí¸üС£Îª¼òµ¥Æð¡¡
¼û£¬Ö»Ð轫ÕâЩֵ¸³ÎªNULL¡£¡¡¡¡
µ«ÁíÒ»·½Ã棬ÎÒÃÇ»¹ÐèÒª½«º¯ÊýOnUpdate¼Óµ½ÊÓ´°ÀàÖУ¬ÒÔ´¦ÀíÓÉÆä¡¡
ËüÊÓ´°Òý·¢µÄ¸üУ¬Òò´ËÐèÒª´¦Àíº¯ÊýCView£º£ºOnUpdate£º¡¡¡¡
virtual¡¡void¡¡OnUpdate£¨¡¡CView*¡¡pSender£»¡¡LPARAM¡¡lHint£»¡¡CObject*¡¡pHint¡¡£©£»¡¡¡¡
ÆäÖвÎÊýpSenderΪһָÏòÐÞ¸ÄÁËÎĵµµÄÖ¸Õë¡¡£¨µ±ËùÓÐÎĵµ¾ùÐèÒª¸ü¡¡
ÐÂʱ¿ÉÒÔÉèÖøòÎÊýΪNULL£©£¬²ÎÊýlHintÄÚ´æ·Å×ÅÓйØÕâЩÐ޸ĵġ¡
ÐÅÏ¢£¬º¯Êý×îºóÒ»¸ö²ÎÊýpHintÔòΪһ´æ·Å¸ÃÐÞ¸ÄÐÅÏ¢µÄÄÚÈݵÄÖ¸¡¡
Õë¡£¡¡¡¡
ÕâÑù£¬µ±ÈÎÒâÒ»¸öÊÓ´°ÐÞ¸ÄÁËÎĵµÊ±£¬Ëü¾Íµ÷ÓÃpDoc
¡·UpdateAllViews£¬¸Ãº¯ÊýÓÖµ÷ÓÃÓë¸ÃÎĵµÏà¹ØÁªµÄÆäËüËùÓÐÊÓ´°ÖС¡
µÄOnUpdateÀ´¸üÐÂËùÓÐÏÔʾ¡£ÓÉ´Ë£¬ÔÚϵͳÖеÄËùÓÐÊÓ´°¾Í¿ÉÒÔÒ»Æð¡¡
е÷¹¤×÷ÁË¡£µ±ÔÚÈÎÒâÒ»¸öÊÓ´°ÖмüÈëÈκÎÄÚÈÝʱ£¬ÔÚÆäËüÊÓ´°ÖÐÒ²¡¡
¿ÉÒÔ¼ûµ½ÕâЩÄÚÈݱ»ÏÔʾ³öÀ´¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡500¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Í¼8¡£24¡¡ÀàCSplitterWndµÄ²ã´Î¡¡¡¡
ÔÚ³ÌÐòÖд¦Àí¶àÎĵµ£¬µ«Í¬Ê±£¬ÎÒÃÇÒ²¿ÉÒÔͨ¹ý·ÖÀë´°¿ÚÖ§³ÖÒ»¸öÎÄ¡¡
µµµÄ¶à¸öÊÓ¡£·ÖÀë´°¿ÚÊÇÕâÑùÒ»ÖÖ´°¿Ú£¬ËüÃÇÔÚÒ»¸öÊÓ´°Öб»·Ö³É¼¸¡¡
¸öÏà¹ØÁªµÄ²¿·Ö£¬ËäÈ»ËüÃÇÔÚÊÓ´°ÖÐÊÇ·ÖÀëµÄ£¬µ«ËüÃÇͬÑùÐͬ¹¤¡¡
×÷£¬ÈÎÒ»´°¿ÚÖÐËù×öµÄÐÞ¸ÄͬÑùµØ·´Ó¦µ½ÆäËü´°¿ÚÖС£¡¡¡¡
MFCÖÐÖ§³Ö·ÖÀë´°¿ÚµÄÀàÊÇCSplitterWnd£¬¸ÃÀàµÄ²ã´Î½á¹¹Èçͼ¡¡
8¡£24¡£¡¡¡¡
ÒòΪCSplitterWndÀàÓÉCWndÀàÅÉÉú¶øÀ´£¬Ëü¾Í¿ÉÒÔʹÓÃËü±»ÊÚȨʹÓá¡
µÄÄÇһЩCWndÀàµÄ³ÉÔ±º¯Êý¡£¡¡¡¡
class¡¡CMdiSplitFrm¡¡£º¡¡public¡¡CMDIChildWnd¡¡¡¡
£û¡¡¡¡
DECLARE_DYNCREATE£¨CMdiSplitFrm£©¡¡¡¡
protected£º¡¡¡¡
CMdiSplitFrm£¨£©£»¡¡//¡¡protected¡¡constructor¡¡used¡¡by¡¡dynamic¡¡creation¡¡¡¡
//¡¡add¡¡and¡¡remove¡¡member¡¡functions¡¡here¡£¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
//£ý£ýAFX_DISPATCH¡¡¡¡
DECLARE_DISPATCH_MAP£¨£©¡¡¡¡
DECLARE_INTERFACE_MAP£¨£©¡¡¡¡
£ý¡¡¡¡
¡¡¡¡¡¡l¡¡×¢Ò⣺¡¡¡¡
¡¡¡¡¡¡l¡¡ÔÚÕâÀÉæ¼°µ½Ò»¸ö´´½¨ÐÂÀàµÄÎÊÌâ¡£È硡ͼ£¬´ò¿ªClassWizard£¬¡¡
¡¡¡¡¡¡¡¡Ñ¡ÔñAdd¡¡Class¡£¡£È»ºó£¬ÎÒÃǼüÈëÏëÒªÉú³ÉÀàCMdiSplitFrm¡£²¢ÔÚ¡¡
¡¡¡¡¡¡¡¡Base¡¡classµÄÏÂÀÁбíÖÐÑ¡Ôñsplitter×÷Ϊ¸ÃÀàµÄ»ùÀà¡£È硡ͼ¡¡
¡¡¡¡¡¡¡¡8¡£25Ëùʾ¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡501¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Í¼8¡£25¡¡ÀûÓÃClass¡¡Wizard¼ÓÈëÒ»¸öÐÂÀà¡¡¡¡
ÎÒÃÇÔÚÏÂÃæµÄ³ÌÐòÖÐʹÓÃÁËÉÏÃæ½éÉܵÄһЩ¸ÅÄÎÒÃǵijÌÐòÒ²¿ÉÒÔ¡¡
Á¼ºÃµÄÔËÐУ¬µ«ÈÔÓÐÐí¶à¹¤×÷Òª×ö¡£ÎÒÃǵijÌÐòʹÓÃÇ°ÃæÌáµ½µÄ·½·¨¡¡
Éú³ÉÁËÒ»¸öÖ§³Ö´°¿Ú·Ö¸îµÄMDI£¬µ«ÊÇ£¬Ôڲο¼ÎÒÃǵijÌÐò½¨Á¢ÆðÄã¡¡
×Ô¼ºµÄÓ¦ÓóÌÐòÖ®ºó£¬ÎÒÃÇÏ룬ÄãÒ»¶¨»á·¢ÏÖ£¬ÎÒÃǵijÌÐòÀëÒ»¸öºÃ¡¡
Óõıà¼Æ÷ÈÔÓкܳ¤µÄ¾àÀë¡£²»¹ý£¬Í¨¹ýÎÒÃǵÄÖð²½ÍêÉÆ£¬ÎÒÃÇÍêÈ«¡¡
¿ÉÒÔ½«Ëü×öµÃ¸üºÃ¡£¡¡¡¡
ÏÂÃæÎÒÃǸø³öÒ»¸ö³ÌÐòÔËÐеĻÃæ¡¡£¨Èçͼ8¡£26£©¡£Í¬Ê±£¬ÎÒÃÇÒ²¸ø³ö¡¡
Ò»²¿·Ö¹Ø¼üµÄÔ´´úÂ룬ÔÚÐèÒª×Ô¼ºÌí¼ÓµÄ²¿·Ö£¬ÎÒÃÇ»áÒÔ¾ßÓе×ÎƵġ¡
Îı¾±ê³ö£¬Ï£Íû¶ÁÕß×¢ÒâÕâЩµØ·½¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Í¼8¡£26¡¡·Ö¸î´°¿ÚµÄÒ»¸öÔËÐлÃæ¡¡¡¡
//¡¡MdiDoc¡£h¡¡£º¡¡interface¡¡of¡¡the¡¡CMdiDoc¡¡class¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡502¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
#if¡¡£¡defined£¨AFX_MDIDOC_H__6A6E4F01_1FC8_11D2_BC8B_E95B8191F13C__INCLUDED_£©¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
class¡¡CMdiDoc¡¡£º¡¡public¡¡CDocument¡¡¡¡
£û¡¡¡¡
protected£º¡¡//¡¡create¡¡from¡¡serialization¡¡only¡¡¡¡
CMdiDoc£¨£©£»¡¡¡¡
DECLARE_DYNCREATE£¨CMdiDoc£©¡¡¡¡
CSize¡¡m_sizeDoc£»¡¡¡¡
//¡¡Attributes¡¡¡¡
public£º¡¡¡¡
CString¡¡data_string£§100£§£»¡¡¡¡
long¡¡line_number£»¡¡¡¡
//¡¡Operations¡¡¡¡
public£º¡¡¡¡
CSize¡¡GetDocSize£¨£©£ûreturn¡¡m_sizeDoc£»£ý¡¡¡¡¡¡
//¡¡Overrides¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
protected£º¡¡¡¡
protected£º¡¡¡¡
//£û£ûAFX_MSG£¨CMdiDoc£©¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
//£ý£ýAFX_MSG¡¡¡¡
DECLARE_MESSAGE_MAP£¨£©¡¡¡¡
£ý£»¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
#endif¡¡//¡¡£¡defined£¨AFX_MDIDOC_H__6A6E4F01_1FC8_11D2_BC8B_E95B8191F13C__INCLUDED_£©¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡503¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡
//¡¡MdiDoc¡£cpp¡¡£º¡¡implementation¡¡of¡¡the¡¡CMdiDoc¡¡class¡¡¡¡
#include¡¡¡¨stdafx¡£h¡¨¡¡¡¡
//¡¡CMdiDoc¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
IMPLEMENT_DYNCREATE£¨CMdiDoc£»¡¡CDocument£©¡¡¡¡
BEGIN_MESSAGE_MAP£¨CMdiDoc£»¡¡CDocument£©¡¡¡¡
//£û£ûAFX_MSG_MAP£¨CMdiDoc£©¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
//£ý£ýAFX_MSG_MAP¡¡¡¡
END_MESSAGE_MAP£¨£©¡¡¡¡
//¡¡CMdiDoc¡¡construction/destruction¡¡¡¡
CMdiDoc£º£ºCMdiDoc£¨£©¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡add¡¡one¡time¡¡construction¡¡code¡¡here¡¡¡¡
line_number=0£»¡¡¡¡
m_sizeDoc=CSize£¨800£»1000£©£»¡¡¡¡
£ý¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
BOOL¡¡CMdiDoc£º£ºOnNewDocument£¨£©¡¡¡¡
£û¡¡¡¡
if¡¡£¨£¡CDocument£º£ºOnNewDocument£¨£©£©¡¡¡¡
return¡¡FALSE£»¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
return¡¡TRUE£»¡¡¡¡
£ý¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡504¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
//¡¡CMdiDoc¡¡serialization¡¡¡¡
void¡¡CMdiDoc£º£ºSerialize£¨CArchive&¡¡ar£©¡¡¡¡
£û¡¡¡¡
if¡¡£¨ar¡£IsStoring£¨£©£©¡¡¡¡
£û¡¡¡¡
arTextOut£¨0£»yval£»pDoc¡¡·data_string£§loop_index£§£»¡¡¡¡
pDoc¡¡·data_string£§loop_index£§¡£GetLength£¨£©£©£»¡¡¡¡
yval£«=tm¡£tmHeight£»¡¡¡¡
£ý¡¡¡¡
//¡¡TODO£º¡¡add¡¡draw¡¡code¡¡for¡¡native¡¡data¡¡here¡¡¡¡
£ý¡¡¡¡
/////////////////////////////////////////////////////////////////////////////¡¡¡¡
//¡¡CMdiView¡¡printing¡¡¡¡
//¡¡CMdiView¡¡diagnostics¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
#ifdef¡¡_DEBUG¡¡¡¡
void¡¡CMdiView£º£ºAssertValid£¨£©¡¡const¡¡¡¡
¡¡£û¡¡¡¡
CView£º£ºAssertValid£¨£©£»¡¡¡¡
£ý¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
//¡¡CMdiView¡¡message¡¡handlers¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡508¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
void¡¡CMdiView£º£ºOnChar£¨UINT¡¡nChar£»¡¡UINT¡¡nRepCnt£»¡¡UINT¡¡nFlags£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡message¡¡handler¡¡code¡¡here¡¡and/or¡¡call¡¡default¡¡¡¡
CMdiDoc¡¡*pDoc=GetDocument£¨£©£»¡¡¡¡
CClientDC¡¡dc£¨this£©£»¡¡¡¡
OnPrepareDC£¨&dc£©£»¡¡¡¡
if£¨nChar=='r'£©£û¡¡¡¡
pDoc¡¡·line_number£«£«£»¡¡¡¡
£ý¡¡¡¡
else£û¡¡¡¡
pDoc¡¡·data_string£§pDoc¡¡·line_number£§£«=nChar£»¡¡¡¡
TEXTMETRIC¡¡tm£»¡¡¡¡
dc¡£GetTextMetrics£¨&tm£©£»¡¡¡¡
dc¡£TextOut£¨0£»£¨int£©pDoc¡¡·line_number*tm¡£tmHeight£»¡¡¡¡
pDoc¡¡·data_string£§pDoc¡¡·line_number£§£»¡¡¡¡
pDoc¡¡·data_string£§pDoc¡¡·line_number£§¡£GetLength£¨£©£©£»¡¡¡¡
£ý¡¡¡¡
pDoc¡¡·UpdateAllViews£¨this£»0l£»NULL£©£»¡¡¡¡
pDoc¡¡·SetModifiedFlag£¨£©£»¡¡¡¡
CView£º£ºOnChar£¨nChar£»¡¡nRepCnt£»¡¡nFlags£©£»¡¡¡¡
£ý¡¡¡¡
void¡¡CMdiView£º£ºOnUpdate£¨CView*¡¡pSender£»¡¡LPARAM¡¡lHint£»¡¡CObject*¡¡pHint£©¡¡¡¡¡¡
£û¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡specialized¡¡code¡¡here¡¡and/or¡¡call¡¡the¡¡base¡¡class¡¡¡¡
Invalidate£¨£©£»¡¡¡¡
£ý¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡509¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
void¡¡CMdiView£º£ºOnInitialUpdate£¨£©¡¡¡¡¡¡
£û¡¡¡¡
CView£º£ºOnInitialUpdate£¨£©£»¡¡¡¡
//¡¡TODO£º¡¡Add¡¡your¡¡specialized¡¡code¡¡here¡¡and/or¡¡call¡¡the¡¡base¡¡class¡¡¡¡
£ý¡¡¡¡
//¡¡Mdi¡£h¡¡£º¡¡main¡¡header¡¡file¡¡for¡¡the¡¡MDI¡¡application¡¡¡¡
#if¡¡£¡defined£¨AFX_MDI_H__6A6E4EF9_1FC8_11D2_BC8B_E95B8191F13C__INCLUDED_£©¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
/////////////////////////////////////////////////////////////////////////////¡¡¡¡
//¡¡CMdiApp£º¡¡¡¡
//¡¡See¡¡Mdi¡£cpp¡¡for¡¡the¡¡implementation¡¡of¡¡this¡¡class¡¡¡¡
//¡¡¡¡
class¡¡CMdiApp¡¡£º¡¡public¡¡CWinApp¡¡¡¡
£û¡¡¡¡
public£º¡¡¡¡
CMdiApp£¨£©£»¡¡¡¡
//¡¡Overrides¡¡¡¡
//¡¡ClassWizard¡¡generated¡¡virtual¡¡function¡¡overrides¡¡¡¡
//£û£ûAFX_VIRTUAL£¨CMdiApp£©¡¡¡¡
public£º¡¡¡¡
virtual¡¡BOOL¡¡InitInstance£¨£©£»¡¡¡¡
//£ý£ýAFX_VIRTUAL¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
DECLARE_MESSAGE_MAP£¨£©¡¡¡¡
£ý£»¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡510¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
#endif¡¡//¡¡£¡defined£¨AFX_MDI_H__6A6E4EF9_1FC8_11D2_BC8B_E95B8191F13C__INCLUDED_£©¡¡¡¡
¡¡¡¡¡¡¡¡
//¡¡Mdi¡£cpp¡¡£º¡¡Defines¡¡the¡¡class¡¡behaviors¡¡for¡¡the¡¡application¡£¡¡¡¡
#include¡¡¡¨stdafx¡£h¡¨¡¡¡¡
#include¡¡¡¨Mdi¡£h¡¨¡¡¡¡
#include¡¡¡¨MdiSplitFrm¡£h¡¨¡¡¡¡
#include¡¡¡¨MainFrm¡£h¡¨¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
//¡¡CMdiApp¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
//¡¡CMdiApp¡¡construction¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
//¡¡The¡¡one¡¡and¡¡only¡¡CMdiApp¡¡object¡¡¡¡
CMdiApp¡¡theApp£»¡¡¡¡
//¡¡CMdiApp¡¡initialization¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
CMultiDocTemplate*¡¡pDocTemplate£»¡¡¡¡
pDocTemplate¡¡=¡¡new¡¡CMultiDocTemplate£¨¡¡¡¡
IDR_MDITYPE£»¡¡¡¡
RUNTIME_CLASS£¨CMdiDoc£©£»¡¡¡¡
RUNTIME_CLASS£¨CMdiSplitFrm£©£»¡¡//¡¡custom¡¡MDI¡¡splitter¡¡frame¡¡¡¡
RUNTIME_CLASS£¨CMdiView£©£©£»¡¡¡¡
AddDocTemplate£¨pDocTemplate£©£»¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
return¡¡TRUE£»¡¡¡¡
£ý¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡511¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
//¡¡CAboutDlg¡¡dialog¡¡used¡¡for¡¡App¡¡About¡¡¡¡
class¡¡CAboutDlg¡¡£º¡¡public¡¡CDialog¡¡¡¡
£û¡¡¡¡
public£º¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
£ý£»¡¡¡¡
//¡¡¡£¡£¡£¡¡¡¡
/////////////////////////////////////////////////////////////////////////////¡¡¡¡
//¡¡CMdiApp¡¡mands¡¡¡¡
//¾¡¹ÜÀàCSplitterÊÇÎÒÃÇÕâ½ÚµÄÖص㣬µ«ÓÉÓÚÔÚ¸ÃÀàÖÐÎÒÃDz¢Ã»ÓÐÌí¼ÓʲôеĶ«Î÷£¬¶ø¡¡¡¡
//ÓйظÃÀàµÄ»ù´¡ÖªÊ¶ÎÒÃÇÔÚ½²½âÖÐÒѾ×÷Á˽âÊÍ£¬´Ë´¦²»ÔÙÁгö¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡µÚÆß½Ú¡¡Ìí¼Ó¶Ô¶àÎĵµÀàÐ͵ÄÖ§³Ö¡¡¡¡
ÔÚ±¾ÕÂÇ°ÃæµÄ²¿·Ö£¬ÎÒÃÇÒѾ±È½ÏÏêϸµØ¶Ô¶àÎĵµÀàÐÍÖ§³ÖµÄһЩÎÊ¡¡
Ìâ¡£ÔÚ±¾½ÚÖУ¬ÎÒÃÇÖ»¼Æ»®ÔÙ¼òµ¥µØ×÷Ò»»Ø¹Ë£¬ÔÚ±¾½ÚµÄ×îºó²¿·Ö£¬¡¡
ÎÒÃÇÔò¼òµ¥µØ̸̸³ÌÐò¶Ô´òÓ¡µÄÖ§³ÖÊֶΡ£¡¡¡¡
ÔÚ³ÌÐòÖмÓÈë¶àÎĵµµÄÖ§³Ö£¬´Ó¼¼ÊõÉÏÀ´Ëµ£¬Ö»ÊÇÐèÒª½«´°¿ÚµÄÖ±½Ó¡¡
»ùÀà´Óµ¥Îĵµ½çÃæµÄCFrameWnd»»³É¶àÎĵµ³ÌÐòµÄCMDIFrameWnd¾Í¿É¡¡
ÒÔÁË¡£µ«ÊÇ£¬ÓÉÓÚ¶àÎĵµ³ÌÐòµÄÌØÊâÐÔ£¬Ò²³öÏÖÁËһЩÐèÒª²»Í¬´¦Àí¡¡
µÄÎÊÌâ¡£¶Ôÿ¸öÎĵµÀ´Ëµ£¬ËüÃÇËù¹ØÁªµÄÊÓÀà¡¡£¨»òÆäÅÉÉúÀࣩ×ÜÊǽö¡¡
½ö¶ÔÓ¦ÓÚΨһµÄÎĵµ£¬Òò´Ë£¬¶Ô¸÷¸öÎĵµµÄÊý¾ÝµÄ¹ÜÀíʵ¼ÊÉÏÓëµ¥ÎÄ¡¡
µµ³ÌÐòûÓÐʲôÇø±ð£¬µ«ÊÇ£¬ÓÉÓÚ¶à¸öÎĵµµÄ³öÏÖ£¬¶ÔËüÃǵĹÜÀí¾Í¡¡
³ÉΪÖ÷ÒªµÄÎÊÌâ¡£¡¡¡¡
ÎÒÃDz»·ÁÏȽ«ÎÊÌâ¼ò»¯¡£Ã¿Ò»¸öÎĵµ¿ÉÒÔÓжà¸öÊÓ£¬µ«Ã¿¸öÊÓÖ»Äܶԡ¡
Ó¦ÓÚÒ»¸öÈ·¶¨µÄÎĵµ¡£Òò´Ë£¬¶àÎĵµ³ÌÐòÐèÒª½â¾öµÄÎÊÌâ½ö½öÊǶà¸ö¡¡
ÎĵµµÄÊý¾Ý¹ÜÀí·½·¨µÄÎÊÌâ¡¡£¨¶ÔÊÓͼµÄ¹ÜÀíÎÒÃÇÔÚÇ°ÃæÒ»½ÚÖÐÒѾ×÷¡¡
³öÁ˱ȽÏÏêϸµÄ½âÊÍ£©¡£¶Ô¶àÎĵµ³ÌÐòÀ´Ëµ£¬×î³õµÄÎĵµÄ£°åÖ»Ö§³Ö¡¡
Ö÷´°¿Ú£¬µ«Ã¿´Î´ò¿ªÒ»¸öÐÂÎĵµÊ±¶¼µ÷ÓÃCDocumentµÄº¯Êý¡¡
OnNewDocument£¬½¨Á¢Ò»¸öÓÐCMDIChildWndÅÉÉúµÄеÄMDI×Ó´°¿Ú£¬Õâ¡¡
Щ´°¿ÚÖб£´æן÷ÖÖÒÑ´ò¿ªµÄÎĵµ£¬ËùÓеÄϸ½Ú¶¼ÓÉMFC¿â´¦Àí¡£Àý¡¡
È磬µ±Óû§µ¥»÷File²Ëµ¥ÏµÄNew²Ëµ¥Ïîʱ£¬½«Éú³ÉÁíÍâÒ»¸öÎĵµ²¢¡¡
´ò¿ªÆä´°¿Ú¡£µ«ÊÇ£¬Ã¿¸öÎĵµÖгõʼʱ¶¼ÊÇһƬ¿Õ°×£¬Òò´Ë»¹Ðè¼ÓÉÏ¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡512¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÄܶԲ»Í¬µÄ´°¿Úʼþ×÷³ö·´Ó¦µÄ´úÂ롣ÿ¸öMDI×Ó´°¿Ú¶¼Ö§³ÖÓÉÀà¡¡
CViewÅÉÉúµÄÆÕͨÀàÐ͵ÄÊÓ´°£¬Õâ¾ÍÒâζ×Å¿ÉÒÔͬÒÔÇ°Ò»Ñù²»ÊÜÔ¼Êø¡¡
µØʹÓø÷ÀàÏûÏ¢¡£¶ø¶Ô¸÷ÀàÏûÏ¢µÄµ¥¶À´¦Àí£¬¶ÁÕß²»·Á²Î¿¼¶ÔÓ¦¸÷Õ¡¡
µÄ½²½â¡£¡¡¡¡
×÷ΪÎĵµ/ÊӽṹµÄÒ»¸ö×é³É²¿·Ö£¬ÔÚ±¾ÕÂÎÒÃDz¢Ã»ÓжԴòÓ¡ºÍ´òÓ¡¡¡
Ô¤ÀÀÕâÒ»²¿·ÖÄÚÈݽøÐн²Êö¡£ÓÉÓÚƪ·ùµÄÓÐÏÞ£¬ÔÚ±¾ÊéÖÐÎÒÃǽ«²»µ¥¡¡
¶À½²ÊöÈçºÎÌí¼ÓºÍÍêÉÆÓ¦ÓóÌÐòµÄ´òÓ¡Ö§³Ö¡£ÕâÀï½öÖ¸³öÒ»µã£ºÔÚÎÒ¡¡
Ãǽ¨Á¢·Ç»ùÓÚ¶Ô»°¿òµÄ³ÌÐòʱ£¬Èç¹ûÎÒÃÇÑ¡ÔñÁË´òÓ¡Ö§³Ö£¬ÄÇô£¬Ïµ¡¡
ͳÒѾΪÎÒÃÇÍê³ÉÁ˾ø´ó²¿·ÖµÄ¹¤×÷¡£µ«Èç¹ûÎÒÃÇûÓÐÔÚ×î³õµÄÉè¼Æ¡¡
ÖÐÑ¡Ôñ´òÓ¡Ö§³Ö£¬ÄÇô£¬ÎÒÃǾÍÐèÒª¿¼ÂǶÔËü×Ô¼ºÊµÏÖÁË¡£MFCÌṩ¡¡
Á˱ê×¼´òÓ¡¶Ô»°¿òCPrintDialogÀ´¼ò»¯´òÓ¡²Ù×÷¡£¶ÁÕßÈç¹ûÓÐÕâ·½Ãæ¡¡
µÄÐèÒª£¬Çë²Î¿¼ÏµÍ³µÄ°ïÖúÎļþ¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡513¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡µÚ¾ÅÕ¡¡Í¼ÐÎÉ豸½Ó¿Ú¡¡¡¡
ÊÂʵÉÏ£¬Í¼ÐÎÉ豸½Ó¿Ú¡¡£¨Graphics¡¡Device¡¡Interface£¬GDI£©ÊÇÖ¸ÕâÑù¡¡
µÄÒ»¸ö¿ÉÖ´ÐгÌÐò£¬Ëü´¦ÀíÀ´×ÔWindowsÓ¦ÓóÌÐòµÄͼÐκ¯Êýµ÷Ó㬡¡
È»ºó°ÑÕâЩµ÷Óô«µÝ¸øºÏÊʵÄÉ豸Çý¶¯³ÌÐò£¬ÓÉÉ豸Çý¶¯³ÌÐòÀ´Ö´ÐС¡
ÓëÓ²¼þÏà¹ØµÄº¯Êý²¢²úÉú×îºóµÄÊä³ö½á¹û¡£GDI¿ÉÒÔ¿´×÷ÊÇÒ»¸öÓ¦Óá¡
³ÌÐòÓëÊä³öÉ豸֮¼äµÄÖн飬һ·½Ã棬GDIÏòÓ¦ÓóÌÐòÌá¹
¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿!
ÎÂÜ°Ìáʾ£º ο´Ð¡ËµµÄͬʱ·¢±íÆÀÂÛ£¬Ëµ³ö×Ô¼ºµÄ¿´·¨ºÍÆäËüС»ï°éÃÇ·ÖÏíÒ²²»´íŶ£¡·¢±íÊéÆÀ»¹¿ÉÒÔ»ñµÃ»ý·ÖºÍ¾Ñé½±Àø£¬ÈÏÕæдԴ´ÊéÆÀ ±»²ÉÄÉΪ¾«ÆÀ¿ÉÒÔ»ñµÃ´óÁ¿½ð±Ò¡¢»ý·ÖºÍ¾Ñé½±ÀøŶ£¡