1.vbԴ?源码? bitblt
2.vb å¦ä½ç¨BitBltå¤å¶åå°ç¨åºå¾åï¼
vbԴ?? bitblt
function BitBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Rop: DWORD): BOOL; stdcall;
DestDC待画位图的handl,
x,y为待画位图的原点坐标,
Width,源码ios工具源码下载 Height为待画位图的区域大小,
SrcDC为被东东的源码评测网程序源码handl,
XSrc, YSrc为被画东东的原点坐标
width := Screen.Width div 8;
height := Screen.Height div 8;
BitBlt(bipmap.Canvas.Handle, 0, 0, width, height, DC, 1*width{ 原点x坐标}, 0*height{ 原点y坐标}, SRCCOPY);
vb å¦ä½ç¨BitBltå¤å¶åå°ç¨åºå¾åï¼
vbèªå¸¦äºå¿«éå¾çå¤å¶æ´è½ä»¥å代apiå½æ°çbitblt
ä½ å¯ä»¥ç¨paintpictureæ¹æ³å®ç°ï¼æææ´ä¼äºbitbltå½æ°
æ¹æ³ï¼
对象.paintpicture å¾çæºï¼ä¸ºstdpictureåéï¼ä¹å¯ä»¥æ¯å¯¹è±¡.pictureå±æ§ï¼ï¼ç®æ xåæ ï¼ç®æ yåæ ï¼ç®æ é¿,ç®æ 宽ï¼æºxåæ ï¼æºyåæ ï¼æºé¿ï¼æºå®½ï¼å¤çæ¹å¼
å ¶ä¸å¤çæ¹å¼æ好åç§ï¼å ¶ä¸vbsrccopy æ强å¶è¦ç
è¿ä¸ªvbèªå¸¦çå é¨å½æ°å¯ä»¥èªéåºçæ伸ç®æ å¾å
å ·ä½è¯¦ç»æ¹æ³ï¼ä½ å¯ä»¥ä¸é¨æ¥ä¸æ¥vbçpaintpictureæ¹æ³ï¼æç°å¨å¨ç½å§ï¼æ²¡ævbç¨åºï¼æ以åªè½å¸®ä½ å°è¿ç§ç¨åº¦äºï¼è§è° ï¼
BitBltæ¯å°ä¸å¹ ä½å¾ä»ä¸ä¸ªè®¾å¤åºæ¯å¤å¶å°å¦ä¸ä¸ª
ç®æ åæºå¿ é¡»é½æ¯è®¾å¤åºæ¯
ä½ åºè¯¥ç¨SetDIBitsToDevice å°ä¸å¹ ä¸è®¾å¤æ å ³ä½å¾çå ¨é¨æé¨åæ°æ®ç´æ¥å¤å¶å°ä¸ä¸ªè®¾å¤
VB声æ
Declare Function SetDIBitsToDevice Lib "gdi" Alias "SetDIBitsToDevice" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal dx As Long, ByVal dy As Long, ByVal SrcX As Long, ByVal SrcY As Long, ByVal Scan As Long, ByVal NumScans As Long, Bits As Any, BitsInfo As BITMAPINFO, ByVal wUsage As Long) As Long
说æ
å°ä¸å¹ ä¸è®¾å¤æ å ³ä½å¾çå ¨é¨æé¨åæ°æ®ç´æ¥å¤å¶å°ä¸ä¸ªè®¾å¤ãè¿ä¸ªå½æ°å¨è®¾å¤ä¸å®ä¹äºä¸ä¸ªç®æ ç©å½¢ï¼ä»¥ä¾¿æ¥æ¶ä½å¾æ°æ®ãå®ä¹å¨DIBä¸å®ä¹äºä¸ä¸ªæºç©å½¢ï¼ä»¥ä¾¿ä»ä¸æåæ°æ®
è¿åå¼
Longï¼æ§è¡æååè¿åæ«æ线çæ°éï¼é¶è¡¨ç¤ºå¤±è´¥ãä¼è®¾ç½®GetLastError
åæ°è¡¨
åæ° ç±»åå说æ
hdc Longï¼ä¸ä¸ªè®¾å¤åºæ¯çå¥æã该åºæ¯ç¨äºæ¥æ¶ä½å¾æ°æ®
x,y Longï¼ç¨é»è¾åæ 表示çç®æ ç©å½¢çèµ·ç¹
dx,dy Longï¼ç¨ç®æ ç©å½¢ç设å¤åä½è¡¨ç¤ºç宽度åé«åº¦
SrcX,SrcY Longï¼ç¨è®¾å¤åæ 表示çæºç©å½¢å¨DIBä¸çèµ·ç¹
Scan Longï¼Bitsæ°ç»ä¸ç¬¬ä¸æ¡æ«æ线çç¼å·ãå¦BitsInfoä¹BITMAPINFOHEADERé¨åçbiHeightå段æ¯æ£æ°ï¼é£ä¹è¿æ¡æ«æ线就ä¼ä»ä½å¾çåºé¨å¼å§è®¡ç®ï¼å¦ææ¯è´æ°ï¼å°±ä»é¡¶é¨å¼å§è®¡ç®
NumScans Longï¼æ¬²å¤å¶çæ«æ线æ°é
Bits Anyï¼æåä¸ä¸ªç¼å²åºçæéãè¿ä¸ªç¼å²åºå å«äºä»¥DIBæ ¼å¼æè¿°çä½å¾æ°æ®ï¼è¿ç§æ ¼å¼æ¯ç±BitsInfoæå®ç
BitsInfo BITMAPINFOï¼å¯¹Bits DIBçæ ¼å¼åé¢è²è¿è¡æè¿°çä¸ä¸ªç»æ
wUsage Longï¼ä¸è¿°å¸¸æ°ä¹ä¸
DIB_PAL_COLORS é¢è²è¡¨æ¯ä¸ä¸ªæ´æ°æ°ç»ï¼å ¶ä¸å å«äºä¸ç®åéå ¥hdc设å¤åºæ¯çè°è²æ¿ç¸å ³çç´¢å¼
DIB_RGB_COLORS é¢è²è¡¨å å«äºRGé¢è²
注解
ç¨GetDeviceCapså¤æ设å¤æ¯å¦æ¯æè¿ä¸ªå½æ°