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

windows»·¾³ÏÂ32λ»ã±àÓïÑÔ³ÌÐòÉè¼Æ-µÚ35²¿·Ö

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


yÓ¦¸ÃÊÇÔ²ÐÄy¼õÈ¥½Ç¶ÈµÄÓàÏÒÖµ³ËÒ԰뾶¡£_CalcXºÍ_CalcYÊäÈëµÄ²ÎÊýÊǽǶÈ_dwDegreeºÍ°ë¾¶_dwRadius¡£×Ó³ÌÐòÖÐʹÓÃ80x86µÄЭ´¦ÀíÆ÷Ö¸ÁÊ×ÏȽ«½Ç¶ÈÖµ»»Ëã³É»¡¶ÈÖµ¡ª¡ª³ËÒԦв¢³ýÒÔ180£¬È»ºóÓÃÉÏÃæ·ÖÎöµÄ¹«Ê½½øÐи¡µã¼ÆËã²¢½«½á¹û·µ»Ø¡£


ͼ7¡£5¡¡¡¡Ê±ÖÓ³ÌÐòµÄ×ø±ê¼ÆËã

ÔÚ½ÓÏÂÀ´µÄÄÚÈÝÖУ¬ÏȽéÉÜһЩ»æ»­²Ù×÷µÄ±³¾°ÖªÊ¶¡£

7¡£2¡£1¡¡¡¡»­±ÊºÍ»­Ë¢

GDIÖеĻ滭º¯ÊýÓÐ3´óÀࣺ»­µã¡¢»­Ïߺͻ­Ìî³äÇøÓò¡£Ê¹ÓùýPhotoshopµÈͼÐÎÈí¼þµÄ¶ÁÕßÒ»¶¨ÖªµÀ£¬ÔÚ»­Ïß֮ǰÐèҪѡÔñÒ»ÖÖ»­±Ê£¬ÕâÑù»­³öÀ´µÄÏßÌõ¶¼ÊÇ»ùÓÚÕâÖÖ»­±ÊµÄ£»Í¬Ñù£¬Ìî³äÒ»¸öÇøÓò֮ǰÐèҪѡÔñÒ»ÖÖ»­Ë¢£¬ÕâÑùÕû¸öÌî³äÇøÓò½«Öظ´Ê¹ÓÃÕâ¸ö»­Ë¢µÄÑÕÉ«»òͼ°¸¡£

GDIÖÐÒ²ÓÐͬÑùµÄ»­±ÊºÍ»­Ë¢µÄ¸ÅÄ»­±Ê¡¢»­Ë¢ÒÔ¼°ÆäËûһЩGDIÖÐҪʹÓõĶ«Î÷£¬°üÀ¨×ÖÌå¡¢ÇøÓò¡¢Â·¾¶¡¢Í¼°¸ºÍλͼͳ³ÆGDIÖеġ°¶ÔÏó¡±£¬Í¨¹ýSelectObjectº¯Êý¿ÉÒÔÖ¸¶¨Ò»¸öDCµ±Ç°Ê¹ÓõĶÔÏó¶ÔÓ¦Äĸö¶ÔÏó¾ä±ú£¬³ÆΪ¡°µ±Ç°¶ÔÏó¡±£¬µ±ÉèÖÃÁËÒ»¸öµ±Ç°¶ÔÏóµÄʱºò£¬ÒÔºóºÍÕâÖÖ¶ÔÏóÏà¹ØµÄº¯Êý¶¼½«Ê¹Óõ±Ç°¶ÔÏó£¬Ö±µ½ÔÙ´ÎÓÃSelectObjectÑ¡ÔñеĶÔÏóΪֹ¡£±ÈÈçÑ¡ÔñÁËеĻ­±Êºó£¬ÒÔºóËùÓл­Ïߺ¯Êý»­³öÀ´µÄÏßÌõÑùʽ¶¼ÊÇÓÉÕâ¸ö»­±Ê¾ö¶¨µÄ£¬¶øÑ¡ÔñÁËеĻ­Ë¢ºó£¬ÔòËùÓÐÌî³äº¯ÊýÌî³äµÄÑùʽ¶¼½«Ê¹ÓÃÕâ¸ö»­Ë¢¡£

SelectObjectº¯ÊýµÄÓ÷¨ÊÇ£º

¡¡¡¡¡¡¡¡invoke¡¡¡¡SelectObject£¬hDC£¬hGDIObject

¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡hOldObject£»eax

ÆäÖвÎÊýhGDIObject¾ÍÊǶÔÏóµÄ¾ä±ú£¬Ëü¿ÉÒÔÊÇλͼ¾ä±ú¡¢»­±Ê¾ä±ú¡¢»­Ë¢¾ä±ú¡¢×ÖÌå¾ä±ú»òÇøÓò¾ä±ú£¬º¯Êý»á¸ù¾Ý¾ä±úµÄÖÖÀà×Ô¶¯Ìæ»»Ô­ÓеĶÔÏ󣬲¢½«Ô­À´Ê¹ÓõĶÔÏó¾ä±ú·µ»Ø£¨µ±¶ÔÏóÀàÐÍÊÇÇøÓòµÄʱºò³ýÍ⣩£¬Èç¹ûDCÖÐÔ­À´Ã»ÓÐÉèÖõ±Ç°¶ÔÏó£¬ÄÇôº¯ÊýµÄ·µ»ØÖµÊÇGDI_ERROR»òNULL¡£



¡¡
À´Ô´£ºµç×Ó¹¤Òµ³ö°æÉç¡¡×÷ÕߣºÂÞÔƱò¡¡ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡


µÚ7Õ¡¡Í¼ÐβÙ×÷


7¡£2¡¡»æ¡¡ÖÆ¡¡Í¼¡¡ÐΣ¨4£©

¡¡¡¡¡¡¡¡
1¡£¡¡Ê¹ÓÃÔ¤¶¨ÒåµÄ»­±ÊºÍ»­Ë¢

WindowsÔ¤¶¨ÒåÁËһЩ³£ÓõĻ­±ÊºÍ»­Ë¢£¬ÔÚ³ÌÐòÖпÉÒÔÓÃGetStockObjectÀ´»ñÈ¡ËüÃǵľä±ú£¬StockµÄÖÐÎĺ¬ÒåÊÇ¡°³£±¸µÄ¡¢¿â´æµÄ¡±£¬ËùÒÔÕâ¸öº¯Êý×ÖÃæÉϵÄÒâ˼¾ÍÊÇ¡°»ñÈ¡³£ÓõĶÔÏó¡±£¬×¢ÒⲢûÓÐÀàËÆÓÚGetStockPen»òGetStockBrushÖ®ÀàµÄº¯Êý£¬ËùÓлñÈ¡³£ÓöÔÏóµÄ²Ù×÷ͳһʹÓÃGetStockObjectº¯Êý¡£

GetStockObjectº¯ÊýµÄÓ÷¨ÊÇ£º

¡¡¡¡¡¡¡¡invoke¡¡¡¡GetStockObject£¬fnObject

¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡hObject£»eax

fnObject²ÎÊýÊÇÔ¤¶¨ÒåµÄ¶ÔÏóÀàÐÍ£¬¿ÉÒÔÊDZí7¡£2ËùʾµÄÈ¡Öµ¡£

±í7¡£2¡¡¡¡GDIÖеij£ÓöÔÏó

Ô¤¡¡¶¨¡¡Òå¡¡Öµ
¡¡Ëµ¡¡¡¡¡¡¡¡Ã÷
¡¡
BLACK_PEN

WHITE_PEN

NULL_PEN

BLACK_BRUSH

DKGRAY_BRUSH

GRAY_BRUSH

LTGRAY_BRUSH

WHITE_BRUSH

HOLLOW_BRUSH»òNULL_BRUSH

ANSI_FIXED_FONT

ANSI_VAR_FONT

DEFAULT_GUI_FONT£¨Win95£©

OEM_FIXED_FONT

SYSTEM_FONT

DEFAULT_PALETTE
¡¡ºÚÉ«»­±Ê

°×É«»­±Ê

¿Õ»­±Ê

ºÚÉ«»­Ë¢

Éî»ÒÉ«»­Ë¢

»ÒÉ«»­Ë¢

dz»ÒÉ«»­Ë¢

°×É«»­Ë¢

¿Õ»­Ë¢

µÈ¿íϵͳ×ÖÌå

²»µÈ¿íϵͳ×ÖÌå

ĬÈÏϵͳ×ÖÌ壨ÓÃÓڲ˵¥¡¢¶Ô»°¿òµÈ£©

OEMµÈ¿í×ÖÌå

ĬÈÏϵͳ×ÖÌ壨ÓÃÓڲ˵¥¡¢¶Ô»°¿òµÈ£©

ĬÈÏͼ°¸
¡¡

NULL_PENºÍNULL_BRUSHÊÇ¿Õ»­±ÊºÍ¿Õ»­Ë¢£¬Ö®ËùÒÔÓпյĶÔÏó£¬ÊÇÒòΪ»æÖÆÌî³äÇøÓòµÄº¯ÊýͬʱÓõ½ÁË»­±ÊºÍ»­Ë¢¡ª¡ª»æÖƵÄÍâ¿òʹÓõ±Ç°»­±Ê£¬ÖмäÓõ±Ç°»­Ë¢Ìî³ä¡£Ê¹ÓÿնÔÏó¿ÉÒÔÓлú»á»­³öûÓб߿òÏßÖ»ÓÐÌî³äͼ°¸£¬»òÕßÖ»Óб߿òÏ߶ø²»Ìî³äµÄÇøÓòÀ´¡£

ÓÃGetStockObjectº¯ÊýµÃµ½¶ÔÏó¾ä±úÒԺ󣬾ͿÉÒÔÓÃSelectObjectº¯Êý½«¶ÔÏó¾ä±úÉèÖõ½DCÖÐÁË¡£Àý×ÓÎļþClock¡£asmÖеÄ_ShowTimeº¯ÊýÖÐÓÃGetStockObjectº¯Êý»ñÈ¡ÁËÒ»¸öBLACK_BRUSH»­Ë¢£¬ÓÃÀ´»æ»­Ê±ÖӵĿ̶ȡ£

2¡£¡¡Ê¹ÓÃ×Ô¶¨ÒåµÄ»­±ÊºÍ»­Ë¢

ʹÓÃGetStockObjectº¯ÊýµÃµ½µÄ¶ÔÏóÊÇ×î¡°¼òª¡±µÄ£¬Èç»­±ÊÖ»ÄÜÊÇ°×É«»òºÚÉ«µÄ¿í¶ÈΪ1ÏñËصÄʵÏߣ¬»­Ë¢Ö»ÄÜÊÇ°×É«¡¢ºÚÉ«ºÍÓÐÏ޵ļ¸ÖÖ»ÒÉ«É«¿é¡£ÒªÏëʹÓòÊÉ«µÄ¡¢¶àÖÖ¶àÑù·ç¸ñµÄ»­±ÊºÍ»­Ë¢£¬¾Í±ØÐëÓÃ×Ô¶¨ÒåµÄ·½·¨¡£

´´½¨×Ô¶¨ÒåµÄ»­±Ê¿ÉÒÔʹÓÃCreatePen£¬ExtCreatePen»òCreatePenIndirectº¯Êý£¬CreatePenº¯ÊýµÄʹÓ÷½·¨ÊÇ£º

¡¡¡¡¡¡¡¡invoke¡¡¡¡CreatePen£¬fnPenStyle£¬dwWidth£¬dwColor

¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡hPen£¬eax

fnPenStyle²ÎÊýÊÇ»­±Ê·ç¸ñ£¬Ëü¿ÉÒÔÊÇÁ½ÖÖʵÏß·ç¸ñPS_SOLID£¬PS_INSIDEFRAME»ò¿Õ»­±ÊPS_NULL£¬ÒÔ¼°¼¸ÖÖÐéÏß·ç¸ñPS_DASH£¬PS_DOT£¬PS_DASHDOT»òPS_DASHDOTDOT¡£ËüÃǶÔÓ¦µÄÏßÌõÈçͼ7¡£6Ëùʾ£¬Í¼ÖдÓÉϵ½Ï·ֱðÊÇPS_SOLID£¬PS_DASH£¬PS_DOT£¬PS_DASHDOT£¬PS_DASHDOTDOTºÍPS_INSIDEFRAME·ç¸ñµÄÏßÌõ£¬¼¸ÖÖÐéÏߵķç¸ñºÜºÃ¼Ç£¬Ö»Òª¼ÇµÃ¡°µã¡±¾ÍÊÇDOT£¬¡°»®¡±¾ÍÊÇDASH¾Í¿ÉÒÔÁË£¬ÈçPS_DASHDOTDOT·ç¸ñ¾ÍÊÇÓÉ¡°»®¡¢µã¡¢µã¡±Öظ´×é³ÉµÄÐéÏß¡£

PS_SOLIDºÍPS_INSIDEFRAME·ç¸ñµÄ»­±ÊʹÓõĶ¼ÊÇʵÏßÏßÌõ£¬ËüÃÇÖ®¼äµÄÇø±ðÔÚÓÚµ±»­±ÊµÄ¿í¶È´óÓÚ1ÏñËØ¡£ÔÚʹÓÃÇøÓò»æ»­º¯ÊýµÄʱºò£¬PS_SOLIDÏßÌõ»á¾ÓÖл­ÓÚ±ßÏßÉÏ£¬¶øPS_INSIDEFRAMEÏßÌõ»áÈ«²¿»­ÔÚ±ßÏßÀïÃ棬ËüµÄ¿í¶È»áÏòÇøÓòµÄÄÚ²¿À©Õ¹£¬ËùÒÔËüµÄÃû³ÆÊÇInsideFrame¡£


ͼ7¡£6¡¡¡¡¼¸ÖÖ×Ô¶¨Òå»­±Ê·ç¸ñ

CreatePen¡¡º¯ÊýµÄdwWidth²ÎÊý¶¨ÒåÁË»­±ÊµÄ¿í¶È£¬µ¥Î»ÊÇDC×ø±êÓ³Éä·½·¨Öж¨ÒåµÄÂß¼­µ¥Î»£¬Èç¹ûÕâ¸ö²ÎÊýʹÓÃNULL£¬ÄÇôº¯Êý»áʹÓÃ1ÏñËصĿí¶È¡£¿í¶È²ÎÊý»áÓ°Ïìµ½·ç¸ñ²ÎÊý£ºµ±¿í¶È´óÓÚ1µÄʱºò£¬»­±Ê·ç¸ñ²»ÄÜʹÓÃÐéÏߣ¬Õâʱºò¼´Ê¹Ö¸¶¨ÁËÐéÏß·ç¸ñ£¬º¯ÊýÒ²»á×Ô¶¯Ê¹ÓÃPS_SOLID·ç¸ñ¡£dwColor²ÎÊýÖ¸¶¨ÁË»­±ÊµÄÑÕÉ«¡£

Àý×ÓÔ´´úÂëµÄ_ShowTime×Ó³ÌÐòÖÐÓò»Í¬¿í¶ÈµÄÏßÌõÀ´»æ»­Ê±¡¢·Ö¡¢ÃëÖ¸Õ룬»æ»­Ç°¾ÍʹÓÃCreatePenº¯Êý´´½¨Á˲»Í¬¿í¶ÈµÄ»­±Ê¡£

Èç¹ûÐèÒª´´½¨¸ü¸´ÔӵĻ­±Ê£¬¿ÉÒÔʹÓÃExtCreatePenº¯Êý¡£Õâ¸öº¯Êý³ýÁËÓÐCreatePenµÄÈ«²¿¹¦ÄÜÍ⣬»¹¿ÉÒÔÈÃÓû§×Ô¼º¶¨ÒåÏßÌõµÄÑù×Ó£¬ÕâÑù¿ÉÒÔ²»±ØÏÞÖÆÓÚÉÏÃæµÄµãµã»®»®ÁË¡£º¯ÊýµÄÓ÷¨¶ÁÕß¿ÉÒԲο¼º¯ÊýÊֲᡣ

´´½¨×Ô¶¨Òå»­Ë¢¿ÉÒÔʹÓõĺ¯ÊýÓУºCreateSolidBrush£¬CreateHatchBrush£¬CreatePatternBrushºÍCreateBrushIndirect¡£

CreateSolidBrush´´½¨µ¥É«µÄ»­Ë¢£º

¡¡¡¡¡¡¡¡invoke¡¡¡¡CreateSolidBrush£¬dwColor

¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡hBrush£¬eax

ÒªÊäÈëµÄΩһ²ÎÊýÊÇ»­Ë¢µÄÑÕÉ«¡£¶øCreateHatchBrush¿ÉÒÔ´´½¨¼¸ÖÖÔ¤¶¨Òåͼ°¸µÄ»­Ë¢£º

¡¡¡¡¡¡¡¡invoke¡¡¡¡CreateHatchBrush£¬iHatchStyle£¬dwColor

¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡hBrush£¬eax

dwColorÖ¸¶¨ÁËͼ°¸ÏßÌõµÄÑÕÉ«£¬iHatchStyle¶¨ÒåÁ˲»Í¬µÄͼ°¸ÏßÌõ£¬ÕâЩͼ°¸ÏßÌõʵ¼ÊÉÏÊÇÒÔ8¡Á8µÄλͼÖظ´ÆÌ¿ª×é³ÉµÄ£¬iHatchStyleµÄ¶¨ÒåÖµ¿ÉÒÔÊÇHS_BDIAGONAL£¬HS_CROSS£¬HS_DIAGCROSS£¬HS_FDIAGONAL£¬HS_HORIZONTALºÍHS_VERTICAL£¬Õâ6ÖÖͼ°¸µÄ»¨ÑùÔÚͼ7¡£7ÖдÓ×óµ½ÓÒÅÅÁÐÏÔʾ¡£


ͼ7¡£7¡¡¡¡CreateSolidBrushÖеĻ­Ë¢Í¼°¸

Èç¹ûÕâЩ¼òµ¥µÄͼ°¸²»ÄÜÂú×ãʹÓÃÒªÇó£¬CreatePatternBrushÊǸöºÜºÃµÄÑ¡Ôñ£º

¡¡¡¡¡¡¡¡invoke¡¡¡¡CreatePatternBrush£¬hBitmap

¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡hBrush£¬eax

Õâ¸öº¯ÊýÓÃÒ»¸öλͼµ±×ö»­Ë¢µÄͼ°¸£¬µ±Òª»æ»­µÄÇøÓò´óÓÚλͼ³ß´çµÄʱºò£¬Î»Í¼±»Öظ´ÆÌ¿ª£¬¾ÍÏñHTMLÎļþÖеı³¾°Í¼°¸Ò»Ñù¡£¶ÁÕß¿ÉÒÔ³¢ÊÔÒ»ÏÂÓÃÒ»·ù×öÍøÒ³Îļþ±³¾°µÄλͼ´´½¨Ò»¸öλͼ»­Ë¢£¬²¢ÇÒÔÚRegisterClassExʱÔÚWNDCLASSEX½á¹¹ÖеÄhbrBackground×Ö¶ÎÖÐʹÓÃÕâ¸ö»­Ë¢£¬ÕâÑù´´½¨³öÀ´µÄ´°¿Ú±³¾°»áºÍÍøÒ³±³¾°Ò»Ñù»ªÀö£¡¶ÁÕß¿ÉÒԲο¼Ëù¸½¹âÅ̵ÄChapter07TestObjectĿ¼ÖеÄÔ´´úÂë¡£

¶ÔÓÚ×Ô¶¨ÒåµÄ»­±ÊºÍ»­Ë¢£¬»¹ÓÐÆäËû×Ô¶¨ÒåµÄ¶ÔÏó£¬ÔÚ²»ÔÙÐèÒªµÄʱºò±ØÐëʹÓÃDeleteObjectº¯Êýɾ³ý£¬µ«ÊÇҪעÒ⣺µ±¶ÔÏó»¹ÊÇÒ»¸öDCµÄµ±Ç°¶ÔÏóµÄʱºò²»Òª½«Ëüɾ³ý£¬ÔÚɾ³ýÇ°Ó¦¸ÃÈ·¶¨DCÖÐÒѾ­Ñ¡ÈëÁËÆäËûµÄ¶ÔÏó¡£ÓëÖ®Ïà·´£¬ÓÃGetStockObject»ñÈ¡µÄÔ¤¶¨Òå¶ÔÏóʹÓúó²»ÐèҪɾ³ý£¬µ«ÊǶÔËüÃǵ÷ÓÃDeleteObjectҲûÓйØϵ£¬ÒòΪËüÃDz»»á±»ÕæÕýɾ³ý¡£ÓÉÓÚSelectObject·µ»ØÖµ¾ÍÊÇDCÔ­À´Ê¹ÓõĶÔÏó¾ä±ú£¬ËùÒÔɾ³ý¶ÔÏóµÄÒ»¸öºÃʱ»ú¾ÍÊǵ±SelectObject·µ»ØµÄʱºò£¬ÈçÀý×Ó³ÌÐòµÄ_ShowTime×Ó³ÌÐòÖÐÓõģº

¡¡¡¡¡¡¡¡invoke¡¡¡¡CreatePen£»PS_SOLID£»2£»0

¡¡¡¡¡¡¡¡invoke¡¡¡¡SelectObject£»_hDC£»eax

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡invoke¡¡¡¡DeleteObject£»eax

SelectObject½«CreatePen´´½¨µÄ»­±Ê¾ä±úÑ¡ÈëDC£¬·µ»ØÖµeax¾ÍÊÇÒÔǰʹÓõĻ­±Ê¾ä±ú£¬Õâ¸ö¾ä±ú²»ÔÙʹÓÃÁË£¬ËùÒÔ¿ÉÒÔÔÚÏÂÃæÓÃDeleteObjectÖ±½Óɾ³ý£¬¶øÕâ´Î½¨Á¢µÄ»­±Ê¿ÉÒÔÔÚÏ´ÎÖ´ÐÐSelectObjectºóÓÃͬÑùµÄ·½·¨É¾³ý¡£

7¡£2¡£2¡¡¡¡»æÖÆÏñËصã

ÔÚDCÉÏ»æÖÆÏñËصãÊÇ»æͼ×î»ù±¾µÄ²Ù×÷£¬Ê¹Óõķ½·¨ÊÇ£º

¡¡¡¡¡¡¡¡invoke¡¡¡¡SetPixel£¬hDC£¬dwX£¬dwY£¬dwColor

SetPixelº¯ÊýÔÚhDCµÄdwX¡¢dwYλÖÃÒÔdwColorΪÑÕÉ«»­ÉÏÒ»¸öÏñËص㣬Èç¹ûÐèÒª»ñÈ¡hDCÖÐij¸öÏñËص㵱ǰµÄÑÕÉ«Öµ£¬ÄÇô¿ÉÒÔʹÓÃGetPixelº¯Êý£º

¡¡¡¡¡¡¡¡invoke¡¡¡¡GetPixel£¬hDC£¬dwX£¬dwY

¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡dwColor£¬eax

ËäÈ»»æ»­ÏñËØÊÇ×î»ù±¾µÄ»æͼ²Ù×÷·½·¨£¬µ«ÊÇÔÚ³ÌÐòÖÐÒ»°ãºÜÉÙʹÓÃSetPixelº¯Êý£¬ÒòΪËüµÄ¿ªÏúÌ«´óÁË£¬Ö»ÊʺÏÓÃÔÚÐèÒªÉÙÁ¿»æ»­ÏñËصĵط½£¬Èç¹ûÒª»æ»­Ò»¸öÏßÌõ»òÕßÕû¸öÇøÓò£¬ÄÇô×îºÃʹÓû­Ïߺ¯Êý»òÕßÌî³äº¯Êý£¬ÒòΪÕâЩº¯ÊýÊÇÔÚÇý¶¯³ÌÐò¼¶±ðÉÏÍê³ÉµÄ£¬ËùÓеÄÓ²¼þ¼ÓËÙ¹¦Äܶ¼¿ÉÒÔÓÃÉÏ¡£

ͼÐδ¦ÀíÇ°×î»ù±¾µÄ²½ÖèÊÇ»ñÈ¡ÏñËØ£¬µ«Ò²²»Ó¦¸ÃÓÃGetPixelº¯ÊýÀ´»ñÈ¡Ò»´ó¿éµÄÏñËØÊý¾Ý£¬ÀíÓÉÊÇͬÑùµÄ¡£Èç¹ûÒª·ÖÎöÕû¸öÇøÓòµÄÏñËØÊý¾Ý£¬×îºÃµÄ°ì·¨¾ÍÊÇÓÃGetDIBitsº¯Êý½«È«²¿Êý¾Ý¿½±´µ½ÄÚ´æÖÐÔÙ½øÐд¦Àí¡£



¡¡
À´Ô´£ºµç×Ó¹¤Òµ³ö°æÉç¡¡×÷ÕߣºÂÞÔƱò¡¡ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡


µÚ7Õ¡¡Í¼ÐβÙ×÷


7¡£2¡¡»æ¡¡ÖÆ¡¡Í¼¡¡ÐΣ¨5£©

¡¡¡¡¡¡¡¡
7¡£2¡£3¡¡¡¡»æÖÆͼÐÎ

GDIµÄͼÐλæÖƺ¯ÊýÖ÷ÒªÓлæÖÆÏßÌõºÍÌî³äÇøÓòÁ½´óÀà¡£»æÖÆÏßÌõµÄº¯ÊýÒÔµ±Ç°»­±Ê»æÖÆÏßÌõ£»»æÖÆÌî³äÇøÓòµÄº¯ÊýÒÔµ±Ç°»­±Ê»æÖƱßÏߣ¬²¢ÒÔµ±Ç°»­Ë¢Ìî³äÖмäµÄÇøÓò¡£

1¡£¡¡»æÖÆÏßÌõ

»æÖÆÏßÌõµÄº¯ÊýÓл­Ö±ÏßµÄLineTo£¬»­¶àÌõÖ±ÏßµÄPolylineºÍPolylineTo£¬»­±´Èû¶ùÇúÏßµÄPolyBezierºÍPolyBezierTo£¬»­»¡ÏßµÄArcºÍArcTo¡£

DCµÄÊý¾Ý½á¹¹ÖÐÓÐÒ»¸ö¡°µ±Ç°µã¡±£¬LineToº¯Êý¾ÍÊÇ´Óµ±Ç°µã»­Ò»ÌõÖ±Ïßµ½²ÎÊýÖÐÖ¸¶¨µÄµã£¬²¢°Ñ²ÎÊýÖÐÖ¸¶¨µÄµãÉèÖÃΪеĵ±Ç°µã¡£»­Ïߺ¯ÊýÖÐËùÓÐÒÔTo½áβµÄº¯Êý¶¼ÊÇ´Óµ±Ç°µã¿ªÊ¼»æ»­µÄ£¬ÈçLineTo£¬PolylineTo£¬PolyBezierToºÍArcTo£¬ÕâЩº¯ÊýÔڻ滭½áÊøºó»á°Ñ»æÖƵÄ×îºóÒ»µãÉèÖÃΪеĵ±Ç°µã£¬ËùÒÔÔÚʹÓÃÕâЩº¯ÊýµÄʱºòÒª¿¼Âǵ½µ±Ç°µãÒ²ÊDzÎÓë»æÖƵÄ×ø±êÒ»²¿·Ö¡£¶øÆäÓàµÄPolyline£¬PolyBezierºÍArcº¯ÊýÔòºÍµ±Ç°µãûÓйØϵ£¬Ò²²»»áÓ°Ï쵱ǰµãµÄλÖá£

Èç¹ûÒªÉèÖõ±Ç°µãµÄλÖ㬿ÉÒÔʹÓÃMoveToExº¯Êý£º

¡¡¡¡¡¡¡¡invoke¡¡¡¡MoveToEx£¬hDC£¬dwX£¬dwY£¬lpPoint

dwXºÍdwYÖ¸³öÁËеĵ±Ç°µãµÄ×ø±ê£¬lpPointÖ¸ÏòÒ»¸ö¿ÕµÄPOINT½á¹¹£¬ÓÃÀ´·µ»ØÔ­À´µÄµ±Ç°µãλÖã¬Èç¹û²»ÐèÒªµÄ»°£¬Õâ¸ö²ÎÊý¿ÉÒÔʹÓÃNULL¡£

ÁíÒ»¸öº¯ÊýÒ²¿ÉÒԵõ½µ±Ç°µãµÄ×ø±ê£º

¡¡¡¡¡¡¡¡invoke¡¡¡¡GetCurrentPositionEx£¬hDC£¬lpPoint

ͬÑù£¬lpPointÖ¸ÏòÒ»¸öÓÃÀ´·µ»Øµ±Ç°µã×ø±êµÄPOINT½á¹¹µØÖ·¡£

Èç¹ûÒª»æÖÆÒ»ÌõÖ±Ïߣ¬±ØÐëÅäºÏʹÓÃMoveToExºÍLineToº¯Êý£¬Ê×ÏÈÓÉMoveToExº¯ÊýÉèÖÃÒ»¸öµ±Ç°µãµ±×öÆðʼ×ø±ê£¬È»ºóÓÃLineTo»æ»­µ½½áÊø×ø±ê£¬ÈçClock¡£asmÖеÄ_DrawLine×Ó³ÌÐòÖоÍÊÇÕâÑù»æÖÆʱÖÓÖ¸ÕëµÄ£º

¡¡¡¡¡¡¡¡invoke¡¡¡¡MoveToEx£»_hDC£»@dwX1£»@dwY1£»NULL

¡¡¡¡¡¡¡¡invoke¡¡¡¡LineTo£»_hDC£»@dwX2£»@dwY2

ÕâÁ½¾ä´úÂë»æ»­Ò»Ìõ´Ó@dwX1£¬@dwY1µ½@dwX2£¬@dwY2µÄÖ±Ïß¡£

Èç¹ûÒª»æÖÆÊÇÏàÁ¬µÄ¶àÌõÖ±Ïߣ¬¿ÉÒÔʹÓÃPolyline»òPolylineToº¯Êý£º¡¡

¡¡¡¡¡¡¡¡invoke¡¡¡¡PolylineTo£»hDC£»lpPoint£»cPoints

¡¡¡¡¡¡¡¡invoke¡¡¡¡Polyline£»hDC£»lpPoint£»cPoints

lpPointÖ¸ÏòÒ»¸ö°üº¬Ò»ÏµÁÐPOINT½á¹¹µÄ»º³åÇø£¬ÓÉÓÚPOINT½á¹¹Ö»ÓÐXºÍYÁ½¸ö×ֶΣ¬ËùÒÔ»º³åÇøÖеÄÊý¾Ýʵ¼ÊÉÏÊÇx1£¬y1£¬x2£¬y2£¬x3£¬y3£¬¡­£¬cPoints²ÎÊýÖ¸³öÁ˵ãµÄÊýÄ¿£¬×¢Ò⣺PolylineTo»­³öµÄÖ±ÏßÊÇ´Óµ±Ç°µã×ø±ê£¨x£¬y£©¿ªÊ¼£¬È»ºóµ½£¨x1£¬y1£©£¬ÔÙµ½£¨x2£¬y2£©£¬¡­£¬¶øPolylineº¯Êý»­³öµÄÖ±ÏßÊÇ´Ó£¨x1£¬y1£©¿ªÊ¼µÄ£¬¶ÔÓÚÕâ¸öº¯Êý£¬Èç¹ûcPoints²ÎÊýÖ¸¶¨ÁËn¸öµã£¬ÄÇôֱÏßµÄÊýÁ¿Êµ¼ÊÉÏÊÇn£¿1¡£µ±»æÖƵÄÏàÁ¬Ö±ÏߺܶàµÄʱºò£¬ÓÃPolyline»òPolylineTo±È¶à´ÎʹÓÃLineToµÄËÙ¶ÈÒª¿ìºÜ¶à£¬¾ÍÏñÓÃÌî³äº¯Êý±È¶à´ÎʹÓÃSetPixelÒª¿ìÒ»Ñù¡£

±í7¡£3¾ÙÀý˵Ã÷ÁËÕâЩ»­Ïߺ¯ÊýµÄ¹¦ÄÜ£¬±íÖеģ¨x1£¬y1£©»ò£¨x2£¬y2£©µÈ±íʾµã1»òµã2µÄ×ø±ê£¬£¨xc£¬yc£©±íʾµ±Ç°µãµÄ×ø±ê£¬µ±Ç°µãÔÚͼÖÐÓÃc±íʾ¡£

±í7¡£3¡¡¡¡»­Ïߺ¯ÊýµÄ¹¦ÄÜ

º¯¡¡¡¡¡¡¡¡Êý
¡¡Ëµ¡¡¡¡¡¡¡¡Ã÷
¡¡Í¼¡¡¡¡¡¡¡¡Àý
¡¡
LineTo£¨hDC£»x£»y£©
¡¡´Óµ±Ç°µãµ½£¨x£¬y£©µã
¡¡
¡¡
PolylineTo£¨hDC£»lpPoint£»5£©
¡¡lpPointÖ¸Ïò´æ·Å£¨x1£¬y1£©µ½£¨x5£¬y5£©µÄ»º´æÇø£¬º¯Êý»­µÄÏßÌõ´Ó£¨xc£»yc£©µ½£¨x1£¬y1£©µ½£¨x2£¬y2£©¡­µ½£¨x5£¬y5£©£¬¹²5ÌõÖ±Ïß
¡¡
¡¡
Polyline£¨hDC£»lpPoint£»5£©
¡¡lpPointÖ¸Ïò´æ·Å£¨x1£¬y1£©µ½x5¡¢y5µÄ»º´æÇø£¬º¯Êý»­µÄÏßÌõ´Ó£¨x1£¬y1£©µ½£¨x2£¬y2£©¡­µ½£¨x5£¬y5£©£¬¹²4ÌõÖ±Ïß
¡¡
¡¡
PolyBezierTo£¨hDC£»lpPoint£»3£©
¡¡»æ»­µÄBezierÇúÏߵĿØÖƵãΪ£
·µ»ØĿ¼ ÉÏÒ»Ò³ ÏÂÒ»Ò³ »Øµ½¶¥²¿ ÔÞ£¨0£© ²È£¨0£©
¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿!
ÎÂÜ°Ìáʾ£º ο´Ð¡ËµµÄͬʱ·¢±íÆÀÂÛ£¬Ëµ³ö×Ô¼ºµÄ¿´·¨ºÍÆäËüС»ï°éÃÇ·ÖÏíÒ²²»´íŶ£¡·¢±íÊéÆÀ»¹¿ÉÒÔ»ñµÃ»ý·ÖºÍ¾­Ñé½±Àø£¬ÈÏÕæдԭ´´ÊéÆÀ ±»²ÉÄÉΪ¾«ÆÀ¿ÉÒÔ»ñµÃ´óÁ¿½ð±Ò¡¢»ý·ÖºÍ¾­Ñé½±ÀøŶ£¡