|
-
Feb 12th, 2004, 06:44 AM
#1
Thread Starter
Member
Need solution - Printing taskbar unnecessarily
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.
-
Feb 12th, 2004, 09:28 AM
#2
I'm not sure if the X-Y coordinates are the same, the sysinfo control can give you the workareaheight (less taskbar).
-
Feb 12th, 2004, 12:13 PM
#3
Thread Starter
Member
Originally posted by leinad31
I'm not sure if the X-Y coordinates are the same, the sysinfo control can give you the workareaheight (less taskbar).
I can get the exact xy co-ordinates by checking the objects scaleheight & scalewidth properties.
I tried to save the image of the picturebox to clipboard & tried to print but same result.
I tried to save the image of the picturebox to one invisible picturebox & tried to print but same result.
Regards.
-
Feb 12th, 2004, 12:18 PM
#4
Oh... I thought you we're blitting directly from the screen.
-
Feb 12th, 2004, 12:29 PM
#5
Thread Starter
Member
i copied all the data to form, changed form apprearance property to flat & used form.printform but invain.
Regards.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|