p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

vb_howto thread: Image Box Question


Message #1 by "David Smith" <DJSmith@m...> on Tue, 22 May 2001 10:09:28 -0500
In order to duplicate the PictureBox you can make it into a control array 
(just set the index property to 0) and the use the Load statement to 
create another.  It inherits the same picture as the original by default.  
Here's an example using a Form with a PictureBox called Picture1:

    ' create a new picture box
    Load Picture1(mnNextIndex)

    ' position it next to the last one
    Picture1(mnNextIndex).Top = Picture1(mnNextIndex - 1).Top
    Picture1(mnNextIndex).Left = Picture1(mnNextIndex - 1).Left + Picture1
(mnNextIndex - 1).Width

    ' show it
    Picture1(mnNextIndex).Visible = True

    ' this is a form level variable initialised to 1 in Form_Load        
    mnNextIndex = mnNextIndex + 1

I'll leave it to you to work out the code to decide when to move the new 
picture to the next row :-)

Phil
> I want to display an image in an image box, then move the imagebox to a 
new
> location to display it again, but persist the original image.  The effect
> will be to have the image start at one location, and eventually populate 
a
> large portion of the form with a repeated image.  Is this do-able? Is it
> difficult? How do I do it?
> 
> 

  Return to Index