I have a Picturebox with a MsFlexGrid on it, among other controls.
When I print (via printer) the Picturebox, every control on it is printed except the MsFlexGrid, and I need it printed as well.
Thank you.
This is the Print routine I'm using:
Code:'Note - Box could also be a Form, if desired. Public Sub PrintPictureBox(Box As PictureBox, _ Optional X As Single = 0, _ Optional Y As Single = 0) Dim rv As Long Dim ar As Boolean On Error GoTo Exit_Sub With Box 'Save ReDraw value ar = .AutoRedraw 'Set persistance .AutoRedraw = True 'Wake up printer Printer.Print 'Draw controls to picture box rv = SendMessage(.hwnd, WM_PAINT, .hDC, 0) rv = SendMessage(.hwnd, WM_PRINT, .hDC, _ PRF_CHILDREN Or PRF_CLIENT Or PRF_OWNED) 'Refresh image to picture property .Picture = .Image 'Copy picture to Printer Printer.PaintPicture .Picture, X, Y Printer.EndDoc 'Restore backcolor (Re-load picture if picture was used) Box.Line (0, 0)-(.ScaleWidth, .ScaleHeight), .BackColor, BF 'Restore ReDraw .AutoRedraw = ar End With Exit_Sub: If Err.Number Then MsgBox Err.Description, vbOKOnly, "Printer Error!" End Sub


Reply With Quote
