Pictures into pictureBox

Right then heres my problem.

I have a number of images which I would like to place into a picture box within a userControl. I want to know if anybody knows a way of loading these pictures into a picture box (more than one picture is going into one picture box).

 Speed is relatively important and so is the fact that the pictureBox retains it's autoRedraw = true property. I also need to draw boxes and text on top of the pictures and rearrange the pictures in minimum time.

I have tried this using BitBlt and memory DC's however the problem that I get does not allow me to create the picture in the picture box as an autoredraw image which is of no use to me.

What I need is either a work around on the problem I have or a different way to do it.

Help Please?
LVL 1
James_stillmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MaximkaCommented:
You can't do this straight with picturebox , but You can put image with index = 0 on PictureBox and when You need to put You pictures You just do that

 Load Image1(index)
 Set Image1(index).Picture = LoadPicture(MyPath)
 Image1(index).Left = x
 Image1(index).Top = y
 Image1(1).Visible = True

It will create new instances of Image1 and will place it on Your picturebox.
P.S. Don't forget to
  Unload Image1(index)
because VB don't free it untill end of application.
0
adityauCommented:
Use Image controls for more than one images and place them at any place you want.
0
MaximkaCommented:
Thank You very much adityau ,but this is
exactly what I answered.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

adityauCommented:
Yes Maximka. I know. I think both of us tried to give the solution at the same time and you gave it first. Which I did not see and gave the solution. But, after I commented, I saw that.
0
James_stillmanAuthor Commented:
How can I reference the control array of the usercontrol from within a class module?
0
MaximkaCommented:
First of  all You can't , but if You
need it so You do something not right.
Try to look at You problem from other
side. Maybr it will help You:

Create Standard module and put into it
public sub that does
  Load Form1.Image1(index)

0
MaximkaCommented:
First of  all You can't , but if You
need it so You do something not right.
Try to look at You problem from other
side. Maybr it will help You:

Create Standard module and put into it
public sub that does
  Load Form1.Image1(index)

0
James_stillmanAuthor Commented:
Yeah this is my problem the image control array will be placed upon a usercontrol and you cannot do what you have suggested from within a module within a usercontrol as the code would be:

load usercontrol.image1(index)

which is not allowed. And if I try to create a reference to the image1(0) object within a module I am not allowed either.

 And I don't want to access the control array from within the actual usercontrol's code.

Cheers
0
Erick37Commented:
Why not use the PaintPicture method?

Example using a standard exe:

Private pic1 As StdPicture
Private pic2 As StdPicture

Private Sub Form_Load()
    Picture1.AutoRedraw = True
    'Load some pictures
    'Use LoadResPicture if you have a resource
    'file added to the project and don't want to load from files.
    Set pic1 = LoadPicture("c:\windows\tiles.bmp")
    Set pic2 = LoadPicture("c:\windows\waves.bmp")
    UpdatePictures
End Sub

Private Sub UpdatePictures()
    'draw the pictures
    Picture1.PaintPicture pic1, 100, 100
    Picture1.PaintPicture pic2, 500, 500
End Sub

Private Sub Form_Unload(Cancel As Integer)
    'Clear the pictures
    Set pic1 = LoadPicture("")
    Set pic2 = LoadPicture("")
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
James_stillmanAuthor Commented:
Sorry Maximka but you were no help. Thankjs for your time but Erik37 Is the daddy and I will have to give him the points seen as he ansewered just what I wanted
0
James_stillmanAuthor Commented:
Thank You Very Much
0
Erick37Commented:
You're welcome.  Glad to help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.