الطباعة
BitmapInfo.BitmapinfoHeader.biSize = 40
BitmapInfo.BitmapInfoHeader.biWidth = Window_Width
BitmapInfo.BitmapInfoHeader.biHeight = Window_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! = Window_Width / ScreenWidth HeightAspectRatio!= Window_Height / Window_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_Mem, hBmp_Window, 0, Window_Height, IpBits&, BitmapInfo, DIB_RGB_COLORS)
نقل الصورة إلى الطابعة "
r3 = StretchDIBits(hDC_Dest, DestX, DestY, PrintWidth, PrintHeight, 0, 0, Window_Width, Window_Height, IpBits&, BitmapInfo,
End If
DIB_RGB_COLORS, SRCCOPY)
تحرير الذاكرة وحذف الكائنات والسياقات التي صنعناها .
•
r = SelectObject(hDC_Mem, hPrevBmp) r = GlobalUnlock(hMem)
r = GlobalFree(hMem)
r = DeleteDC(hDC_Window)
r = DeleteObject(hBmp_Window)
r = ReleaseDC(hWnd_SrcWindow, hDC_Form)
TAY
ص ٤٢١