atinsuy
08-26-2009, 06:06 PM
I need to be able to print just the Picture Box contents out to paper. The contents of the Picture Box are created via text file. I tried a few codes but it doesn't work. It prints a picture box but it doesn't have the contents in it. It's just a blank pict box. Please help me!:confused:
Take a look at the sample project attached.
jerome_gail26
08-26-2009, 07:14 PM
i tried the attached project it prints Picturebox' Picture
atinsuy
08-27-2009, 06:02 PM
Are you sure? How? I tried it so many times.
jerome_gail26
08-27-2009, 06:24 PM
I would like to make it clear. The file that you attached does not have form (just a module.), so i created form, button and picturebox.
On my form, here is the code.
Private Sub Command1_Click()
PrintPictureBox Picture1, 100, 300
End Sub
atinsuy
08-27-2009, 07:33 PM
Hi
Take a look at the sample project attached again.
I also found new source code to print the content of the pic box but there is an error. Help me.
jerome_gail26
08-27-2009, 08:27 PM
On module PrintPictureToSize. you got invalid property error msg because .ScaleHeight 's value is negative.
Private Sub CreateTempPic(Frm As Form, Pic As PictureBox)
On Error Resume Next
' Create a picturebox to hold the image of the form
Set picTemp = Frm.Controls.Add("VB.PictureBox", "picTemp")
With picTemp
.AutoRedraw = True
.BorderStyle = vbBSNone
.Width = Pic.Width
.Height = Pic.Height
.Left = Frm.Left + Frm.Width
.Visible = True
End With
' place the image of the form in the picture box
BitBlt picTemp.hDC, 0, 0, Pic.Width, Pic.Height, Pic.hDC, 0, 0, SRCCOPY
picTemp.Picture = picTemp.Image
End Sub
atinsuy
08-29-2009, 05:38 PM
I have it working now. Thanks jerome_gail26 for your help on this.:)