Link to home
Start Free TrialLog in
Avatar of James_stillman
James_stillman

asked on

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?
Avatar of Maximka
Maximka

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.
Use Image controls for more than one images and place them at any place you want.
Thank You very much adityau ,but this is
exactly what I answered.
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.
Avatar of James_stillman

ASKER

How can I reference the control array of the usercontrol from within a class module?
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)

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)

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
ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Thank You Very Much
You're welcome.  Glad to help.