Results 1 to 10 of 10

Thread: Weird issue with PictureBox control

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Wisconsin
    Posts
    788

    Weird issue with PictureBox control

    Everytime I reference the picturebox control the image/picture disappears. For example:

    Private Sub Command1_Click()

    PicturePrint.Picture = Picture2.Picture
    End Sub

    Neither PictureBox has an image.



    Picture2.Picture is initially set by a third party control (Secugen SDK). AutoRedraw is set to true.

    Any ideas? Also, when something on the screen covers an area of Picture2 that area is no longer visible.

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Weird issue with PictureBox control

    Are you sure that Picture2.Picture is set?
    Perhaps Secugen SDK writes to the .Image so what you want is.
    PicturePrint.Picture = Picture2.Image

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Wisconsin
    Posts
    788

    Re: Weird issue with PictureBox control

    How can I be sure whether .Image and/or .Picture has data?

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Wisconsin
    Posts
    788

    Re: Weird issue with PictureBox control

    During debugging I stop on the line and check the Picture2.Image.Height and Picture2.Image.Width properties and there was data there. The numbers are not the dimensions of the control?

  5. #5
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Weird issue with PictureBox control

    Have you tried

    Set PicturePrint.Picture = Picture2.Picture


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Wisconsin
    Posts
    788

    Re: Weird issue with PictureBox control

    Quote Originally Posted by jmsrickland View Post
    Have you tried

    Set PicturePrint.Picture = Picture2.Picture
    Yes. As soon as it hits that line of code the image disappears.

  7. #7
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Weird issue with PictureBox control

    You might not realize that jmsrickland didn't say:
    PicturePrint.Picture = Picture2.Picture
    he said
    Set PicturePrint.Picture = Picture2.Picture
    The "Set" is assigning an object to another object, which is different than what you showed in post #1.

    The .Image context will exist, because you set AutoRedraw to True.
    I would assume that the scanner would write the scanned image to the picturebox, and if you can see it, it means it is in the .Image context of the picturebox because you have AutoRedraw set True. You can't bitblt or draw into the .Picture context of a picturebox normally, you have to assign an image to it.
    If you look at the value of Picture2.Image.Width, you should see a large value, as the value is in HiMetric units.
    You can covert from HiMetric to another unit, pixels for instance, like this
    WidthInPixels = ScaleX(Picture2.Image.Width,vbHiMetric,vbPixels)

    If you look at the value of Picture2.Picture.Width, you will probably see 0, as there is likely to be no image loaded into the .Picture context of the picturebox.

    That is why I suggested trying to assign the .Image to the other picturebox instead of the .Picture.
    On the otherhand, since these are objects, I don't know if I would try to assign one to the other, otherwise they could both be pointing to the same object, which you might not want.
    You could always use
    PicturePrint.PaintPicture Picture2.Image, 0,0
    to see if you can paint the image from Picture2 to the other picturebox, so it would definitely be no connection between the two images.
    Last edited by passel; Jan 29th, 2014 at 05:07 PM.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Wisconsin
    Posts
    788

    Re: Weird issue with PictureBox control

    I have tried the various ways described. I talked to the Secugen people and they informed me that their control is only creating the raw image file. This may be why the image disappears. I now need to find out how to deal with the raw image data. This data is in a byte[] called buffer. Does anybody have any ideas or samples for dealing with raw image data?

  9. #9
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Weird issue with PictureBox control

    What are you using the thirdparty control for?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Wisconsin
    Posts
    788

    Re: Weird issue with PictureBox control

    To capture a fingerprint.

    I think i just need to prepend the data with bitmap information. Struggling to find a good example.....

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