Results 1 to 3 of 3

Thread: blt problems

  1. #1

    Thread Starter
    Frenzied Member ae_jester's Avatar
    Join Date
    Jun 2001
    Location
    Kitchener Ontario Canada Earth
    Posts
    1,545

    blt problems

    I want to copy the contents of a picturebox called picture3 into an invisible picturebox called picHold so that I can print it.

    Why doesnt this work properly? I get an image that looks nowhere near what the original picture box looks like.

    VB Code:
    1. BitBlt picHold.hDC, 0, 0, Picture3.Width, Picture3.Height, frmPrintAvailability.hDC, Picture3.Left, Picture3.Top, vbSrcCopy
    2.     Printer.PaintPicture picHold.Image, 0, 0
    3.     Printer.EndDoc

  2. #2
    Frenzied Member
    Join Date
    Aug 2001
    Posts
    1,075
    Try this...

    VB Code:
    1. 'can be set in the properties window
    2. picHold.ScaleMode = vbPixel
    3. Picture3.ScaleMode = vbPixel
    4.  
    5. BitBlt picHold.hDC, 0, 0, Picture3.ScaleWidth, Picture3.ScaleHeight, Picture3.hDC, 0, 0, vbSrcCopy
    6.     Printer.PaintPicture picHold.Image, 0, 0
    7.     Printer.EndDoc

    Greg
    Free VB Add-In - The Reference Librarian
    Click Here for screen shot and download link.

  3. #3
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Originally posted by gdebacker
    Try this...

    VB Code:
    1. 'can be set in the properties window
    2. picHold.ScaleMode = vbPixel
    3. Picture3.ScaleMode = vbPixel
    4.  
    5. BitBlt picHold.hDC, 0, 0, Picture3.ScaleWidth, Picture3.ScaleHeight, Picture3.hDC, 0, 0, vbSrcCopy
    6.     Printer.PaintPicture picHold.Image, 0, 0
    7.     Printer.EndDoc

    Greg
    Yes, and no.
    Make sure the Scale mode of the picture boxes are the same as each other, and the form they are housing them in, but don't change your original code.

    Greg, the code you gave doesn't actually work in this instance, as I am not sure, but I think he may have got this idea from a post of mine, or at least has the same idea as me.

    Using the .hDC of the Picture doesn't copy any controls which may be housed in that picture box, so you need the form.hDC which it is in, and you need to reference the X,Y of the pictureBox on the form.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

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