[转帖]Print the contents of an MS FlexGrid
Print the contents of an MS FlexGrid Unfortunately the MS FlexGrid control doesn't have built in print functionality. However, the following code demostrates a simple technique for overcoming this limitation:
'Purpose : Prints the contents of a Microsoft flexgrid.
'Inputs : fgPrint The flexgrid to print
' [lOrientation] The paper orientation (either vbPRORPortrait or vbPRORLandscape)
' [lTopBorder] The paper's top border.
' [lLeftBorder] The paper's left border.
'Outputs : Returns True if the grid was successfully printed.
'Author : Andrew Baker
'Date : 03/09/2001 13:58
'Notes : The ScaleMode property of object determines the unit of measure used for the paper borders.
'Revisions :
Function FlexGridPrint(fgPrint As MSFlexGrid, Optional lOrientation As Long = vbPRORPortrait, Optional lTopBorder As Long = 1000, Optional lLeftBorder As Long = 1000) As Boolean
On Error GoTo ErrFailed
Printer.Orientation = lOrientation
Printer.PaintPicture fgPrint.Picture, lLeftBorder, lTopBorder
'Print the grid
Printer.EndDoc
FlexGridPrint = True
Exit Function
ErrFailed:
'Failed to print grid
FlexGridPrint = False
End Function
如何用这段代码实现打印MSFlexGrid的功能?
我反正研究不出来
请各位指点