Loading images and labels in picturebox 
Author Message
 Loading images and labels in picturebox
I am using VB 6.0.
I am trying to add images and labels to a picturebox ccontrol. I need
to create a .BMP file displaying these contents. When I add multiple
images to the picture box only one is visible ( the last one as it is
inside a loop). I guess the other images are hidden behind this one. I
am having trouble setting the location of these images. Can someone
tell me what is wrong in my code ?

Following is the code that I used to accomplish the above :

'Code for labels
Picture2.AutoRedraw = True
Picture2.CurrentX = Label_BK(Index).Left
Picture2.CurrentY = Label_BK(Index).Top + 3120
Set Picture2.Font = Label_BK(Index).Font
Picture2.ForeColor = Label_BK(Index).ForeColor
Picture2.Print Label_BK(Index).Caption

'Code for images
Picture2.AutoRedraw = True
Picture2.Picture = Picture_FT(Index).Picture
Picture2.CurrentX = snap!Hor_Loc
Picture2.CurrentY = snap!Vert_Loc

Am I missing something...

Sam



Mon, 12 Dec 2005 00:04:54 GMT  
 Loading images and labels in picturebox
Each image you load completely replaces the one before it. One of these samples may help.

Create a Transparent Bitmap
http://www.thescarms.com/vbasic/ClearBitmap.asp

Aa Image Combiner
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=243...

Combine 2 Graphics
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=120...

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep it in the groups..


Quote:
> I am using VB 6.0.
> I am trying to add images and labels to a picturebox ccontrol. I need
> to create a .BMP file displaying these contents. When I add multiple
> images to the picture box only one is visible ( the last one as it is
> inside a loop). I guess the other images are hidden behind this one. I
> am having trouble setting the location of these images. Can someone
> tell me what is wrong in my code ?

> Following is the code that I used to accomplish the above :

> 'Code for labels
> Picture2.AutoRedraw = True
> Picture2.CurrentX = Label_BK(Index).Left
> Picture2.CurrentY = Label_BK(Index).Top + 3120
> Set Picture2.Font = Label_BK(Index).Font
> Picture2.ForeColor = Label_BK(Index).ForeColor
> Picture2.Print Label_BK(Index).Caption

> 'Code for images
> Picture2.AutoRedraw = True
> Picture2.Picture = Picture_FT(Index).Picture
> Picture2.CurrentX = snap!Hor_Loc
> Picture2.CurrentY = snap!Vert_Loc

> Am I missing something...

> Sam



Mon, 12 Dec 2005 00:18:02 GMT  
 Loading images and labels in picturebox

Quote:
> I am using VB 6.0.
> I am trying to add images and labels to a picturebox ccontrol. I need
> to create a .BMP file displaying these contents. When I add multiple
> images to the picture box only one is visible ( the last one as it is
> inside a loop). I guess the other images are hidden behind this one. I
> am having trouble setting the location of these images. Can someone
> tell me what is wrong in my code ?

> Following is the code that I used to accomplish the above :

> 'Code for images
> Picture2.AutoRedraw = True
> Picture2.Picture = Picture_FT(Index).Picture
> Picture2.CurrentX = snap!Hor_Loc
> Picture2.CurrentY = snap!Vert_Loc

> Am I missing something...

Yes, as Ken said, this line is replacing your picrtures:

Quote:
> Picture2.Picture = Picture_FT(Index).Picture

You need to use PaintPicture to copy the picture over.

 Picture2.PaintPicture Picture_FT(Index).Picture, X, Y

(Set X and Y to whatever you need to position it correctly)

LFS



Mon, 12 Dec 2005 00:59:54 GMT  
 Loading images and labels in picturebox

Quote:


>> I am using VB 6.0.
>> I am trying to add images and labels to a picturebox ccontrol. I need
>> to create a .BMP file displaying these contents. When I add multiple
>> images to the picture box only one is visible ( the last one as it is
>> inside a loop). I guess the other images are hidden behind this one. I
>> am having trouble setting the location of these images. Can someone
>> tell me what is wrong in my code ?

>> Following is the code that I used to accomplish the above :

>> 'Code for images
>> Picture2.AutoRedraw = True
>> Picture2.Picture = Picture_FT(Index).Picture
>> Picture2.CurrentX = snap!Hor_Loc
>> Picture2.CurrentY = snap!Vert_Loc

>> Am I missing something...

>Yes, as Ken said, this line is replacing your picrtures:

>> Picture2.Picture = Picture_FT(Index).Picture

>You need to use PaintPicture to copy the picture over.

> Picture2.PaintPicture Picture_FT(Index).Picture, X, Y

>(Set X and Y to whatever you need to position it correctly)

>LFS

Even using this the final image is a composit of the two, or more, images. NOT individual images.
If the OP is thinking of something like, for example, Animate GIF's then you'll need to have a PictureBox/ImageControl for each image and page through
them OR use the Animation Control OR an ImageList/ImageControl comibnation.. or some such thingie... :->

Have a good day...

Don



Mon, 12 Dec 2005 01:16:15 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Loading images and labels in picturebox

2. Help!! Loading PictureBox FromStream and PictureBox.Image.Save

3. load a Jpeg image into a picturebox or image control

4. Loaded image in Image or PictureBox control

5. Loading an image from a webserver into a PictureBox or Image

6. Error loading GIF or JPG image in PictureBox or Image controls

7. Loading an Image to a PictureBox Object

8. Picturebox load image problem

9. Save An Appended Image file loaded in the PictureBox

10. loading image or picturebox control from access 3.0 db w/ DAO

11. Save An Appended Image file loaded in the PictureBox

12. Cancel loading of large picture into PictureBox or Image control

 

 
Powered by phpBB® Forum Software