You BitBlt from the grid to the Printer object. I made up the scale 1...8000 because I don't know the size (in twips) of the grid.
Your program knows that. You will also have to position the output on the printer. with x and y.
to change the size of the printed object use StrecthBlt api, which does BitBlt plus a re-size of the image.
Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Long) As Long
Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Public Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
Dim GridDC as long
GridDC = GetDC(MyDatagrid1.hwnd)
' bitblt data to printer.hDC
Call BitBlt(Printer.hDC,1,1,8000,12000,GridDC,1,1,SRCCOPY)
Printer.EndDoc
Enter your message below
Sign in or Join us (it's free).