Results 1 to 9 of 9

Thread: picturebox image to memory

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    picturebox image to memory

    Hi

    I'm using the clipboard to hold bmp's temporarily. There's gotta be a better way to hold pics in memory and then retrieve them. Could anyone educate me on how to do this?

    Joey O.

  2. #2
    New Member
    Join Date
    Aug 2001
    Location
    Whangarei, New Zealand
    Posts
    1
    Just use Loadpicture(filename as string)
    It loads the image into memory and returns the handle for the image.
    here'a an example:

    h as long
    h=loadpicture("C:\picture.bmp")' the picture is loaded
    ' and you have the handle 'h'
    'Now to use the image
    picture1.picture=h




    Hope this helps,

    -EnZedVBer
    Last edited by EnZedVBer; Aug 26th, 2001 at 08:18 PM.

  3. #3
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    I'm not sure if you have to declare it "As Long" or "As New STDPicture" (I think that's the name). If it doesn't work, just don't declare it as Variant and it should work (I think)
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    Thanks but I don't want to use files at all ...

    HI

    Thanks but I don't want to use files at all. I've been selecting portions of bmp's and using paintpicture function to send them to clipboard. I'd much rather just get the handle so I can load into an array.

    I'll re-phrase the question:
    How can I give the left, top, height, and width of any section of a bmp a handle that will persist untill I destroy it (and how do I destroy it)?

  5. #5
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Basically, you wanna have something like a picturebox's Picture property, but without a picturebox, right?
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    Yes, but I would like that property to be able to hold an array of bmp formatted sections dictated by the user at runtime.
    I've got no problem redimming or any of that stuff, I just don't know how to take a section of a picture outlined by say line (200,200)-(800,800),,B and get a handle on it without writing it to the clipboard or to a physical file.

  7. #7
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Hum, you could use PaintPicture to paint a section of a picture into another picture

    If you wanna know how to create a picture like a variable, you'll have to wait a bit... I think it's like "Dim A As New Bitmap" but I'm sure that's not the real name...
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    Yes - More help needed

    Yes! Please stay in touch. That is what I want to do. I want to hold sections of my bmps within variables!

    I still want to know how to get the handle of the current bmp in a picturebox too though.

  9. #9
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    The handle is the .hDc property. But why do you need that? It's only used with BitBlt and stuff like that

    I'm not 100% sure, but this might work:

    VB Code:
    1. Dim A As StdPicture
    2. Set A = 'Here you can have either LoadPicture() or a picture property

    The only problem is that I can paint to it, but not resize it. And I can't make it just have a blank image

    Maybe you should just keep the coordinates of the part of the image you're interested in, and paint from those coords whenever you need to. It would be much easier
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

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