I am printing the report created & displayed in picturebox. Picturebox contents few labels & listview. The form & picturebox is more in height than my screen resolution. Whenever i am printing using following code, it print the report perfectly but print system taskbar too.
Any solution.
VB Code:
Option Explicit 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 Private Const SRCCOPY = &HCC0020 Private Sub PrintPictureBox(Pic As PictureBox) Dim picTemp As PictureBox Set picTemp = Controls.Add("VB.PictureBox", "picTemp") With picTemp .AutoRedraw = True .BorderStyle = vbBSNone .Width = Pic.ScaleWidth .Height = Pic.ScaleHeight .Left = Me.Width .Visible = True End With BitBlt picTemp.hDC, 0, 0, Pic.Width, Pic.Height, Pic.hDC, 0, 0, SRCCOPY picTemp.Picture = picTemp.Image Printer.Print Printer.PaintPicture picTemp.Image, 0, 0 Printer.EndDoc Set picTemp = Nothing End Sub Private Sub Picture1_Click() PrintPictureBox Picture1 End Sub Private Sub Picture1_DblClick() Unload Me End Sub
Thanking in anticipation.
Regards.




Reply With Quote