Results 1 to 5 of 5

Thread: Need solution - Printing taskbar unnecessarily

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2004
    Location
    THANE
    Posts
    37

    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:
    1. Option Explicit
    2.  
    3. Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
    4.                 ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, _
    5.                 ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, _
    6.                 ByVal ySrc As Long, ByVal dwRop As Long) As Long
    7. Private Const SRCCOPY = &HCC0020
    8.  
    9.  
    10. Private Sub PrintPictureBox(Pic As PictureBox)
    11. Dim picTemp As PictureBox
    12.  
    13.     Set picTemp = Controls.Add("VB.PictureBox", "picTemp")
    14.    
    15.     With picTemp
    16.         .AutoRedraw = True
    17.         .BorderStyle = vbBSNone
    18.         .Width = Pic.ScaleWidth
    19.         .Height = Pic.ScaleHeight
    20.         .Left = Me.Width
    21.         .Visible = True
    22.     End With
    23.  
    24.     BitBlt picTemp.hDC, 0, 0, Pic.Width, Pic.Height, Pic.hDC, 0, 0, SRCCOPY
    25.    
    26.     picTemp.Picture = picTemp.Image
    27.    
    28.     Printer.Print
    29.     Printer.PaintPicture picTemp.Image, 0, 0
    30.     Printer.EndDoc
    31.    
    32.     Set picTemp = Nothing
    33. End Sub
    34.  
    35.  
    36.  
    37.  
    38. Private Sub Picture1_Click()
    39. PrintPictureBox Picture1
    40. End Sub
    41.  
    42. Private Sub Picture1_DblClick()
    43. Unload Me
    44. End Sub


    Thanking in anticipation.


    Regards.
    From Manoj's Desk

  2. #2
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    I'm not sure if the X-Y coordinates are the same, the sysinfo control can give you the workareaheight (less taskbar).

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2004
    Location
    THANE
    Posts
    37
    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.
    From Manoj's Desk

  4. #4
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    Oh... I thought you we're blitting directly from the screen.

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2004
    Location
    THANE
    Posts
    37
    i copied all the data to form, changed form apprearance property to flat & used form.printform but invain.


    Regards.
    From Manoj's Desk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width