Results 1 to 16 of 16

Thread: Printing picture using PaintPicture method

  1. #1

    Thread Starter
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512

    Printing picture using PaintPicture method

    Hi chaps and chapesses,

    I have a picturebox on the screen that i load with a picture. I use Bitstretch and bitblt to modify the image and then print it to the printer.

    Why then do i get the original image printed and not the modified image (as the picture on the screen is the modified one)?

    Any help would save me from insanity,

    Cheers peeps
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  2. #2

    Thread Starter
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512
    Sorted it!!! It was because i was using Paintpicture.mypicture.PICTURE instead of Paintpicture.mypicture.IMAGE.

    Seems that PICTURE property contains original image and IMAGE property contains modified image.

    Cheers
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  3. #3
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573
    Originally posted by Blobby
    Seems that PICTURE property contains original image and IMAGE property contains modified image.

    Cheers
    That's interesting... By the way, did you use some other picturebox for doing the stretchblt & bitblt manipulations? I often use other (invisible) pictureboxes but would like to know if they are really necessary.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  4. #4

    Thread Starter
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512
    Hi chap,

    Well when i printed the .IMAGE I got the old image (before the edit), but when i printed the .IMAGE, i got the newly edited changes. It may be something to do with not having the .AUTOREDRAW property set as that dictates whether u need to do a .REFRESH or not as the picture can be manipulated in memory without affecting the actual image until u r ready.

    As for your other question it depends what you are trying to do as regards whether you need extra picture boxes. I did as it made the programming/testing of it easier as i could see exactly the pictures i was working with. When u get strange results, its sometimes hard to find out whats going wrong when u have a large image being played with. Especially if you are mixing pixel and twips scalemodes,
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  5. #5
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573
    Originally posted by Blobby
    ...its sometimes hard to find out whats going wrong when u have a large image being played with. Especially if you are mixing pixel and twips scalemodes,
    Hi bloke,

    I agree with that. My question however was rather if the source and destination device contexts could be the same in a call to, say, Bilblt, i.e. if you could use the same picturebox as both source and destination.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  6. #6

    Thread Starter
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512
    Indeed you can.

    In the very app i was having trouble in i am moving a large portion of the image to the left by about 20% using the imagebox as both source AND destination.

    Works a treat
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  7. #7
    New Member
    Join Date
    Oct 2003
    Location
    Pakistan
    Posts
    15

    Question What to do while printing a whole form

    hey Blob just read ur posts... seems u can help me out with a prob.... i m usin stretchBlt for printing a portion of a picture into another one... but the thing is that i have to print the whole form... how do i specify that the "Me.PrintForm" takes the image property of the picture box rather than picture....

    plz help me out with this...

    lookin forward
    There are 10 types of people in this world
    Those who understand BINARY and those who do not!
    ---- aami

  8. #8

    Thread Starter
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512
    Hi aami, sorry for late reply, been on holiday.

    Can you explain a bit more precisely what you are doing?

    Cheers
    Blobby
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  9. #9
    New Member
    Join Date
    Oct 2003
    Location
    Pakistan
    Posts
    15

    ya here goes the description

    c friend 1st of all thxn a lottt 4 ur concern... its perfectly all right 2 reply a bit late, every1 has got their own stuff 2 do... neway...

    i ve written an application with 2 forms, one of which is the main form (frmMain) n the other 1 (frmPrint) is meant for printing in a specific format. i pass all the info and parameters to the frmPrint alongwith a picture and its portions using the stretchBlt function... When the frmPrint gets printed, all the fields are printed except the portions painted using the stretchBlt... these areas are left blank (white) on the printout.... if u r still not clear i can send u the code as well

    regards
    There are 10 types of people in this world
    Those who understand BINARY and those who do not!
    ---- aami

  10. #10

    Thread Starter
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512
    Oky doky, i understand. Have you got some runnable code that i can use to demonstrate (if you dont want to send me the whole project). I may be able to simply fix the code and send it you back.

    Cheers
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  11. #11
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132
    Check out attachments, aami. You might benefit from my sample.

    Cheers

  12. #12
    New Member
    Join Date
    Oct 2003
    Location
    Pakistan
    Posts
    15

    URGENT nd caught

    hey guys rhinobull nd blobby thnx a lot 4 ur replies, 'coz i really need da thingi very very urgent as my deadline is just 2 days away.... da prob wid me is that i m at place far frm home b coz of da death of a relative, so i don't have nethin like vb stuff available here.... 2morrow i ll go 2 univ nd check ur code rhino... nd blobby! i have absolutely no prob in sendin u the actual proj, the only hurdle is its size as it is a highly multiform application havin so much graphics stuff, nd ll take me ages 2 upload it... i ll send u its manuals and links when i upload it... u'll find it an interesting one...

    Thanx a lot nd i ll b lookin 4ward 2 a solution 2morrow or da day after...
    There are 10 types of people in this world
    Those who understand BINARY and those who do not!
    ---- aami

  13. #13
    New Member
    Join Date
    Oct 2003
    Location
    Pakistan
    Posts
    15

    HERE IS THE THINGIE

    hey guys
    here's da EXACT situation.... all i need is if somebody can print the whole form through ne printer..... i have put a load button that loads the part of the picture(larger1) to da smaller 1... The print button prints the whole form on the printer.... the prob is that smaller picture is not gettin printed, 'coz it has been painted usin stretchBlt...

    pleeeeeeeeeeeeeez gimme some solution 2 it i m really caught

    thanx nd desperately waitin

    Regards
    Attached Files Attached Files
    There are 10 types of people in this world
    Those who understand BINARY and those who do not!
    ---- aami

  14. #14

    Thread Starter
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512
    Hi mate,

    Thats an easy one

    When you use bitblt/stretchblt, it modifes the IMAGE property of a
    picturebox. But ME.PRINTFORM only prints the ME.PICTURE property. You have
    to set the pictureboxs AUTOREDRAW property to TRUE, then set the PICTURE
    property = IMAGE property for it to work.

    New code should be:

    VB Code:
    1. Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
    2.  
    3. Private Sub Command1_Click()
    4. Call StretchBlt(Picture1.hdc, 0, 0, Picture1.Width / Screen.TwipsPerPixelX, Picture1.Height / Screen.TwipsPerPixelY, Picture2.hdc, 0, 0, Picture2.Width / Screen.TwipsPerPixelX, Picture2.Height / Screen.TwipsPerPixelY, vbSrcCopy)
    5. Picture1.Refresh
    6. Picture1.Picture = Picture1.Image
    7. End Sub
    8.  
    9. Private Sub Command2_Click()
    10. Me.PrintForm
    11. End Sub

    Also, you should set the PICTURE1.AUTOREDRAW property to TRUE.
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  15. #15
    New Member
    Join Date
    Oct 2003
    Location
    Pakistan
    Posts
    15

    Talking woooooooooooo

    hey i don't beleive it wuz sooooooooooooo simple..... BLOBBY u sure r a life saver.... thank u soo very much 4 ur support nd concern....

    thnx a millionnnnnnn
    There are 10 types of people in this world
    Those who understand BINARY and those who do not!
    ---- aami

  16. #16

    Thread Starter
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512
    No probs, like most things, easy when you know how.......just knowing how is the tough bit
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

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