PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Robert Rioja on November 11, 2009, 01:32:52 PM

Title: print form
Post by: Robert Rioja on November 11, 2009, 01:32:52 PM
In VB, there is a PrintForm method.  How do I send a form to the printer in FF3?
Title: Re: print form
Post by: Paul Squires on November 11, 2009, 02:34:10 PM
No idea how to do this.

Anyone else here know if this can be done? Could be a VB only thing.

Title: Re: print form
Post by: Haakon Birkeland on November 11, 2009, 04:55:21 PM
Never really thought of it, but the first thought that comes to me is to determine the area of the form in question, grab a screenshot â€" and then printing the resulting bitmap ...
Title: Re: print form
Post by: Richard Marchessault on November 12, 2009, 11:27:57 PM
In the following routine I capture the active window to a file. Later I print that file. Is this what you were looking to do?


Sub CaptureBitmap(Pict$, Tm As Long)
  Local hImage As Dword
  Pict$ = DataPath$ + "BP_Image" + Trim$(Str$(Tm)) + ".bmp"
  If Isfile(Pict$) Then     'Delete existing file
    Kill Pict$
    Do While Isfile(Pict$)
      Sleep 100
    Loop                    'Make sure it is deleted before continuing
  End If
  SetCursorPos 0, 0 'Move cursor out of the way
  Clipboard Reset 'clear the clipboard
  Keybd_event(%VK_SnapShot, 1, 0, 0) 'active dialog to clipboard
  Do
    FF_DoEvents
    Clipboard Get Bitmap hImage, LL    'get handle to bitmap
  Loop Until LL
  Graphic Attach hImage, 0        'attach to handle
  Graphic Save Pict$ 'save the captured image
  Do
    Sleep 100
  Loop Until Isfile(Pict$) 'Wait till the save is completed
  Graphic Bitmap End
End Sub

Title: Re: print form
Post by: Robert Rioja on November 13, 2009, 12:46:53 PM
I guess this is as close as we'll get to PrintForm.  Thanks for your help.  I will try it.  It is interesting that PrintForm was in VB 6 but Microsoft left it out of VB.NET.  However, there were so many complaints that they released a PrintForm add-on for .NET, and there are several others who sell their own implementations.  They all work only for .NET and cannot be used with PB or FF.

I hope that a future version of FF will have this capability built in.

Title: Re: print form
Post by: Douglas McDonald on February 10, 2010, 07:40:08 PM
Thank you for this sample code its just what I needed. I had ask the same question on the Pb forums ,How to print a dialog / form, and the PB people even thought the solution was pretty cool. The sample there was buy Gary Beene but its about identical

Thanks
Doug