Solved

Copying Properties from one Image or Picture box to another

Posted on 1998-11-02
10
150 Views
Last Modified: 2011-09-20
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
0
Comment
Question by:Vingamel
  • 6
  • 3
10 Comments
 
LVL 3

Accepted Solution

by:
TheAnswerMan earned 100 total points
Comment Utility
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
   
0
 
LVL 3

Expert Comment

by:TheAnswerMan
Comment Utility
oops.. dont forget the
Dim TheHeight as single
0
 
LVL 3

Expert Comment

by:TheAnswerMan
Comment Utility
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
   Load imgTile(x)
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
0
 
LVL 1

Author Comment

by:Vingamel
Comment Utility
Thanks...Code looks like it should work fine.  You are an Expert.   --Vingamel
0
 
LVL 1

Author Comment

by:Vingamel
Comment Utility
Thanks...Code looks like it should work fine.  You are an Expert.   --Vingamel
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 1

Author Comment

by:Vingamel
Comment Utility
Thanks...Code looks like it should work fine.  You are an Expert.   --Vingamel
0
 
LVL 1

Author Comment

by:Vingamel
Comment Utility
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
0
 
LVL 1

Author Comment

by:Vingamel
Comment Utility
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
0
 
LVL 13

Expert Comment

by:Mirkwood
Comment Utility
Bought This Question.
0
 
LVL 1

Author Comment

by:Vingamel
Comment Utility
What do you mean "Bought this Question"  Thanks.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now