الطباعة
المنطقة الداخلية من النافذة إلى السياق في الذاكرة . انسخ
r = BitBlt(hDC_MemClient, 0, 0, Client Width, Client Height, hDC_Mem, xDiff, yDiff, SRCCOPY)
r = SelectObject(hDC_Mem, hPrevBmp)
امسح سياق النافذة، لم نعد نحتاج له '
r = DeleteDC(hDC_Window)
r = DeleteObject(hBmp_Window)
BitsPerPixel = GetDeviceCaps(hDC_MemClient, BITSPIXEL) ColorPlanes = GetDeviceCaps(hDC_MemClient, PLANES)
BitmapInfo.BitmapInfoHeader.biSize = 40 BitmapInfo.BitmapInfoHeader.biWidth = Client Width BitmapInfo.BitmapInfoHeader.biHeight = Client_Height BitmapInfo.BitmapInfoHeader.biPlanes = 1
BitmapInfo.BitmapInfoHeader.biBitCount
= BitsPerPixel* ColorPlanes
BitmapInfo.BitmapinfoHeader.biCompression = BI_RGB
BitmapInfo.BitmapInfoHeader.biSizelmage=0
BitmapInfo.BitmapInfoHeader.biXPelsPerMeter = 0 Bitmapinfo.BitmapInfoHeader.biYPelsPerMeter = 0 BitmapInfo.BitmapInfoHeader.biClrUsed = 0 BitmapInfo.BitmapInfoHeader.biClrimportant = 0
WidthRatio! = Client Width / ScreenWidth HeightAspectRatio! = Client_Height / Client_Width PrintWidth = WidthRatio! * DestDevWidth PrintHeight = HeightAspectRatio! * PrintWidth
BytesNeeded& = CLng(Window_Width + 1) * (Window_Height + 1)
احسب عدد البايت المطلوب لتخزين الصورة "
احجز الذاكرة المطلوبة "
hMem = GlobalAlloc(GMEM_MOVEABLE, BytesNeeded&)
If hDC_Window <> 0 And hBmp_Window <> 0 And hDC_Dest <> 0 And hMem <> 0 Then
IpBits&= GlobalLock(hMem)
r2 = GetDIBits(hDC_MemClient, hBmp_Client, 0, Client Height, IpBits&,
TAY
BitmapInfo, DIB_RGB_COLORS)
ص ٤٢٥