# Copying Properties from one Image or Picture box to another

I am creating a tile-base game and have been putting image boxes on a form.  I want to be able to save the properties )height, width, etc) of one image box and paste them to the form making a grid of equal sized "tiles".  I am doing it the hard I way I think by slapping an image box on the form and then modifying properties for Height. Left, Top & Width.  Height & Width should stay the same, but the Top and Left properties change depending on where on the form the image box is located.  With 15 x 15 pixel image boxes, this is very tedious.  Any ideas?  Thanks.  --Vingamel
LVL 1
###### Who is Participating?

x
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.

Commented:
Use an array of images.
225 of them in your case.. 0 to 224
Dim TheWidth as single
TheWidth = imgTile(0).Width
TheHeight = imgTile(0).Height
for x = 0 to 14
for y = 0 to 14
imgTile(y * 15 + x).Move x * TheWidth, Y * TheHeight
next y
next x

Experts Exchange Solution brought to you by

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

Commented:
oops.. dont forget the
Dim TheHeight as single
Commented:
Here is something that will be ok..

Private Sub Form_Click()
Dim TheWidth As Single
Dim TheHeight As Single
Dim x As Integer
Dim y As Integer
For x = 1 To 224
Next x
TheWidth = imgTile(0).Width
TheHeight = imgTile(0).Height
For x = 0 To 14
For y = 0 To 14
imgTile(y * 15 + x).Move x * TheWidth, y * TheHeight
Next y
Next x
For x = 1 To 224
imgTile(x).Visible = True
Next x

End Sub
Author Commented:
Thanks...Code looks like it should work fine.  You are an Expert.   --Vingamel
Author Commented:
Thanks...Code looks like it should work fine.  You are an Expert.   --Vingamel
Author Commented:
Thanks...Code looks like it should work fine.  You are an Expert.   --Vingamel
Author Commented:
I got this stuff to work great except for two problems:
1) Low resource & memory errors...is there a more efficient way of doing this than with a control array of bitmaps?
2) the first tile in the control array (Image1(0).Visible) cannot be changed to False...it is always visible even when I change value of all tiles to Visible = False.  When I run it, it blinks for a second, then the image tile becomes visible again.  Any clues?  Thanks.  --Vingamel
Author Commented:
I got this stuff to work great except for two problems:
1) Low resource & memory errors...is there a more efficient way of doing this than with a control array of bitmaps?
2) the first tile in the control array (Image1(0).Visible) cannot be changed to False...it is always visible even when I change value of all tiles to Visible = False.  When I run it, it blinks for a second, then the image tile becomes visible again.  Any clues?  Thanks.  --Vingamel
Commented:
Bought This Question.
Author Commented:
What do you mean "Bought this Question"  Thanks.
###### 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.