Results 1 to 4 of 4

Thread: Custom user control and printing issues.

  1. #1

    Thread Starter
    Hyperactive Member jazFunk's Avatar
    Join Date
    Dec 2008
    Location
    Palm Harbor
    Posts
    407

    Custom user control and printing issues.

    I created a user control and a background image. I use the printDocument component and then drawToBitmap to print.

    The issue is that there are areas of the bitmap which aren't printing correctly (blank).

    When I remove the background image, the print-out looks just the way I expect it to. With the background image in place, printing is whacky as I mentioned above.

    Any ideas what the problem may be?

    Here's my code:
    Code:
    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
            ' Print only panel 1 and its contents
            Dim b As New Bitmap(Panel1.ClientSize.Width, Panel1.ClientSize.Height)
            Panel1.DrawToBitmap(b, Panel1.ClientRectangle)
            e.Graphics.DrawImage(b, New Point(0, 0))
        End Sub

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Custom user control and printing issues.

    Can you attach some screenshots and/or images to demonstrate the issue? Also, what exactly is on the Panel?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member jazFunk's Avatar
    Join Date
    Dec 2008
    Location
    Palm Harbor
    Posts
    407

    Re: Custom user control and printing issues.

    I'm at home for the weekend. Unfortunately, no printer. :-(

    The panel consists of all the items I want printed, including:

    A table, which contains document title and various document details.
    Below that, 5 instances of the user control I created.

    The table and user controls both have .png images imported as resources as their background. As you may recall the problem is associated with using background images. Without them, printing seems to work with no issues.

    Is there a simple modification I can make to my printDocument1 control to print to FILE (ie. .bmp, .png., etc.) as opposed to print to PRINTER?

    I tried to use a code example I found on a forum but it didn't seem to work. Maybe I have to provide a dialog to save the bitmap?...I simply don't know. If so, then I could throw those images up today.

    Maybe you're off for the weekend as well.

    Either way, as always, I appreciate your willingness to help. It's nice to know there others out there who are willing to share the knowledge. I am a musician and do the same in my profession.

    Thanks again.
    Last edited by jazFunk; Dec 13th, 2008 at 04:33 PM.

  4. #4

    Thread Starter
    Hyperactive Member jazFunk's Avatar
    Join Date
    Dec 2008
    Location
    Palm Harbor
    Posts
    407

    Re: Custom user control and printing issues.

    Ok, so... Attached are two images. One is a screen shot (only part of the form) of how the print should look. The other is the printed page, scanned.

    On the scanned image, a portion of the left and top middle of the image does not print. This seems to only occur when I set background images for the controls and table.
    Attached Images Attached Images   

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