Home > BSPrinter documentation > Reference

PrintWindow Method

Applies to: PrintPreview, IPrinterEx object

  Return Type:     None.  
 
  Parameter(s):  
   In     Required     hWnd     As     Long  
   In     Optional     X     As     Variant  
   In     Optional     Y     As     Variant  
   In     Optional     OnlyClientArea     As     Boolean     Default value: False  
   In     Optional     ScaleFactor     As     Single     Default value: 1  
   In     Optional     CenteredHoriz     As     Boolean     Default value: False  
   In     Optional     ShrinkToFit     As     Boolean     Default value: True  
   In/Out     Optional     PrintedX     As     Variant  
   In/Out     Optional     PrintedY     As     Variant  
   In/Out     Optional     PrintedWidth     As     Variant  
   In/Out     Optional     PrintedHeight     As     Variant  


Description:

Prints the image of a window given its handle.
The window can be a control, a form, or any window that has a DC.
The printed image is how the control or window appears on the screen.
Windowless controls, such as Label or Shape, cannot be printed using this method.
The control must be visible, but it can be placed outside the visible area or covered with other controls.

Parameters:

hWnd: handle of the window to be printed.

X: the X position where the image will be printed. If not supplied, CurrentX is used.

Y: the Y position where the image will be printed. If not supplied, CurrentY is used.

OnlyClientArea: If True, only the client area will be printed (not the title bar and in some windows types the borders and scroll bars)

ScaleFactor: Scale of the printed image, the default is 1.

PrintedX Returns the X position where the image was printed.

PrintedY Returns the Y position where the image was printed.

PrintedWidth Returns the Width of the printed image.

PrintedWidth Returns the Height of the printed image.

Notes:

It requires Windows XP or later.

Printer.CurrentX won't be updated, but Printer.CurrentY will be positioned after the image.

See Also:

PrintForm method