It is easy to print a form's details directly by printer:
Printer.Print Form1
How about saving it as an image (BMP or JPG) file ?
I have a SaveScreen function but it also save the title bar of an active window.
Pls help...
Printable View
It is easy to print a form's details directly by printer:
Printer.Print Form1
How about saving it as an image (BMP or JPG) file ?
I have a SaveScreen function but it also save the title bar of an active window.
Pls help...
Use the function: What is does is copy the Form's DC to a PictureBox, then we save it by calling the SavePicture function.
Make sure that the PictureBox (in the pBox argument) is invisible.
And you would call it like:VB Code:
Private Declare Function BitBlt Lib "gdi32" (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 Sub SaveScreen(vFrm As Form, pBox As PictureBox, sFileName As String) Dim iWidth As Integer, iHeight As Integer pBox.Visible = False pBox.AutoRedraw = True vFrm.AutoRedraw = False pBox.Move 0, 0, vFrm.ScaleWidth, vFrm.ScaleHeight iHeight = vFrm.ScaleHeight / Screen.TwipsPerPixelY iWidth = vFrm.ScaleWidth / Screen.TwipsPerPixelX BitBlt pBox.hDC, 0, 0, iWidth, iHeight, vFrm.hDC, 0, 0, vbSrcCopy SavePicture pBox.Image, sFileName End Sub
VB Code:
SaveScreen Form1, Picture1, "C:\MyFile.bmp"