|
-
Aug 25th, 2001, 09:47 PM
#1
Thread Starter
Hyperactive Member
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.
-
Aug 26th, 2001, 12:50 AM
#2
New Member
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.
-
Aug 27th, 2001, 12:23 PM
#3
Frenzied Member
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)
-
Aug 27th, 2001, 11:03 PM
#4
Thread Starter
Hyperactive Member
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)?
-
Aug 28th, 2001, 10:23 AM
#5
Frenzied Member
Basically, you wanna have something like a picturebox's Picture property, but without a picturebox, right?
-
Aug 28th, 2001, 11:45 PM
#6
Thread Starter
Hyperactive Member
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.
-
Aug 30th, 2001, 08:25 PM
#7
Frenzied Member
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...
-
Aug 30th, 2001, 10:10 PM
#8
Thread Starter
Hyperactive Member
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.
-
Sep 1st, 2001, 10:57 AM
#9
Frenzied Member
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:
Dim A As StdPicture
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|