Results 1 to 22 of 22

Thread: [RESOLVED] how to print the bitblt image

  1. #1

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    40

    Resolved [RESOLVED] how to print the bitblt image

    Plz help me guys on how to print the bitblt image. i am using the form or the picturebox to hold the bitblted image. Tnx and more power.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: how to print the bitblt image

    Perhaps...
    Code:
    Printer.PaintPicture Picture1.Picture 'or Picture1.Image
    You may also need to set Orientation and/or scale image itself to fit paper - both technics can be found using search (there are plenty of samples posted).

  3. #3
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: how to print the bitblt image

    Many samples on BitBlt. I also have a few. xD Just search "BitBlt" in graphics and programming section, or even on here. =)
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  4. #4

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    40

    Re: how to print the bitblt image

    i tried already the paintpicture method but stil no image printed, is there any other way to print the bitblted image?

  5. #5
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: how to print the bitblt image

    You have to make sure that the form's Autoredraw property is set to true, and scale mode is set to 3-pixel. Same with the picturebox.
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  6. #6

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    40

    Re: how to print the bitblt image

    how can i pass the bitblted image to a picturebox as picture so that i can print the content easily. maybe through printform method only. because when i get the .picture of a bitblted image in the picture box, it returns 0.

  7. #7

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    40

    Re: how to print the bitblt image

    i already setted the scalemode to 3-pixels and autoredraw to true but still there is no image printed

  8. #8
    Fanatic Member FireXtol's Avatar
    Join Date
    Apr 2010
    Posts
    874

    Re: how to print the bitblt image

    Bitmaps get blted to the .Image and not the .Picture.

    So you could print the .Image and not the .Picture.

    Or you could set the .Picture to the .Image manually. Then use .Picture.

  9. #9
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: how to print the bitblt image

    When you bitblt, are you using the .hDC, and not the image in that picturebox? LIke
    Bitblt picPicture.hDC, 0, 0, intPictureWidth, intPictureHeight, Form1.picDestination.hdc, vbSrcCopy
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  10. #10

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    40

    Re: how to print the bitblt image

    yes, im bitblting using the .hdc of a picturebox, i also used the vbSrcCopy. What should i do then?

  11. #11
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: how to print the bitblt image

    can u show the code that you have done so far?
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  12. #12

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    40

    Re: how to print the bitblt image

    here's how i bitblted the image,

    '--------start
    face.imgfback.ScaleMode = 1
    With facecard_dummy
    .Cls
    .width = face.width
    .height = face.height
    .Picture1.width = face.imgfback.width
    .Picture1.height = face.imgfback.height - 80
    'face.imgfback.ScaleMode = 2
    BitBlt .Picture1.hdc, 0, 0, .Picture1.width, .Picture1.height, face.imgfback.hdc, 0, 0, vbSrcCopy

    End With
    'face.imgfback.ScaleMode = 3
    face.imgfback.ScaleMode = 1

    '------end

  13. #13
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: how to print the bitblt image

    Try this:
    Code:
    '--------start
    face.imgfback.ScaleMode = 3
    Picture1.ScaleMode = 3
    With facecard_dummy
    .Cls
    .width = face.width
    .height = face.height
    .Picture1.width = face.imgfback.width
    .Picture1.height = face.imgfback.height - 80
    'face.imgfback.ScaleMode = 2
    end with
    BitBlt Picture1.hdc, 0, 0, Picture1.width, Picture1.height, face.imgfback.hdc, 0, 0, vbSrcCopy
    
    'face.imgfback.ScaleMode = 3
    face.imgfback.ScaleMode = 1
    
    '------end
    If that doesn't work, can u try to attack you whole project? Maybe some other code is conflicting as well. You never know. =)
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  14. #14

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    40

    Re: how to print the bitblt image

    if i used that code, how can i print the bitblted image?

  15. #15
    Fanatic Member FireXtol's Avatar
    Join Date
    Apr 2010
    Posts
    874

    Re: how to print the bitblt image

    Try this:
    1. Make sure the PictureBox's AutoRedraw is True
    2. Blt image to the PictureBox
    3. Printer.PaintPicture PictureBox.Image, ....

  16. #16
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: how to print the bitblt image

    you want to print it? Like after it has been bitblted to the destination? Well, you could do what FireXTol said. =)
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  17. #17

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    40

    Re: how to print the bitblt image

    i tried that already but i got the problem on the bitblted image, it includes the objects around. unlike when i setted the autoredraw to false it only gets the precise image but no image on printing. what should i do?

  18. #18

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    40

    Re: how to print the bitblt image

    is there a way to pass the bitblted image to the other picture box?

  19. #19

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    40

    Re: how to print the bitblt image

    can you show to me the complete sample code 4 that? do i need also to consider the scalemode of the picturebox and the scalemode of a printer?

  20. #20
    Fanatic Member FireXtol's Avatar
    Join Date
    Apr 2010
    Posts
    874

    Re: how to print the bitblt image

    vb Code:
    1. face.imgfback.ScaleMode = 1
    2. With facecard_dummy
    3. .Cls
    4. .width = face.width
    5. .height = face.height
    6. .Picture1.width = face.imgfback.width
    7. .Picture1.height = face.imgfback.height - 80
    8. 'face.imgfback.ScaleMode = 2
    9. .Picture1.AutoRedraw = True 'step 1
    10. BitBlt .Picture1.hdc, 0, 0, .Picture1.width, .Picture1.height, face.imgfback.hdc, 0, 0, vbSrcCopy 'step 2
    11. 'Now either print the Picture1.Image, or:
    12. 'Picture1.Picture = Picture1.Image 'now print the Picture1.Picture
    13. End With
    14. 'face.imgfback.ScaleMode = 3
    15. face.imgfback.ScaleMode = 1

  21. #21

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    40

    Re: how to print the bitblt image

    tnx for your idea guys, i got it already. You had contributed much to this solution. God Bless and More Power to you guys

  22. #22
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: how to print the bitblt image

    xD Glad i could help with what i can. mainly others did more, but np. =) Can u please mark this thread resolved then? At the top of your first post, in the blue, it has Thread Tools, and then Mark Thread Resolved. Thanks!
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

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