[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Visual Basic help

Posted on 2002-04-15
14
Medium Priority
?
208 Views
Last Modified: 2013-11-25
Now, I want to know something in Visual Basic. I made the declaration:

Dim X(0 To 10, 0 To 1) As Image

Now say I wanted the image in X at 1,1 to be pic1.bmp, and the one a 2,1 to be pic2.bmp? What I am getting at is building a map from a bunch on images in an array. How do I go about doing it? Of course each image will be stored in different spaces (e.g. 16 by 16 tiles). Can someone help me? Code would help.
0
Comment
Question by:Linky
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 2
  • +1
14 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6943245
Create an array of singles or longs, open each picture with loadpicture function and use paintpicture function to paste each image in a picture box control with a for next loop.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6943435
I agree with Richie.  There's no need to load the images into an internal array unless you plan on using them for many different things, in which case a control array may be more appropriate:

Create Image1(0), visible=false
At runtime:

For i=0 to 10
  for j=0 to 1
    Load Image1(i*2+j)
    with Image1(i*2+j)
      .Picture = LoadPicture([filename,maybe from an array])
      .move [left],[top]
      .visible=true
    end with
  next j
next i

Depending on the fileformat, this may be easy.  Also, depending on the file sizes, the [left] and [top] values may be calculated or may need a calculation to determine where the last one went.  If they're 16x16 as you indicate, then use:  .move i*16, j*16 ' or j*16, i*16 for 2 columns
0
 
LVL 22

Accepted Solution

by:
rspahitz earned 200 total points
ID: 6943439
I agree with Richie.  There's no need to load the images into an internal array unless you plan on using them for many different things, in which case a control array may be more appropriate:

Create Image1(0), visible=false
At runtime:

For i=0 to 10
  for j=0 to 1
    Load Image1(i*2+j)
    with Image1(i*2+j)
      .Picture = LoadPicture([filename,maybe from an array])
      .move [left],[top]
      .visible=true
    end with
  next j
next i

Depending on the fileformat, this may be easy.  Also, depending on the file sizes, the [left] and [top] values may be calculated or may need a calculation to determine where the last one went.  If they're 16x16 as you indicate, then use:  .move i*16, j*16 ' or j*16, i*16 for 2 columns
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:rspahitz
ID: 6943443
Hmm...EE glitch...
0
 
LVL 2

Author Comment

by:Linky
ID: 6943509
Thanks a lot.
0
 
LVL 1

Expert Comment

by:ProgramIT
ID: 6943979
I'd suggest using the Microsoft PictureClip control .  Define the are in Rows and Columns and then the map can be loaded as one complete pic but section are available
Then by using GraphicCell(CellNo you can access individual sections.
Place a PictureClip on a form. Load the full image.
Set the number of Rows and Columns you want the picture split into.
Then if you wanted to show just the 3rd section in a seperate picturebox then
Picture1.Picture = PictureClip.GraphicCell(3)
Note the PictureClip is not visible during running.
I found the PictureClip also very handy for things like graphic interfaces etc.  Where numerous pictures are required for buttons etc, with using one complete graphic of the whole thing.
Just a thought, Hope it helps.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6944697
Nice comment ProgramIT, but in this case i think, we are talking of different images (overlapped?) not a split of one.
Linky, do you need more code/help? Just ask.
Cheers
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6946240
ProgramIT, I just played with the PictureClip control and it will definitely find a place in my future...thanks!

But as Richie said, I think the question here is the opposite: how do I assemble those pictures...I think that nce they're assembled into a picturebox, the remaining image could be saved then the PictureClip control could be used as the storage array to access individual pieces (assuming they're all the same size.)  This Q seems to be an issue of showing all at once, not just the the parts.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6946743
I agree.
Hi Linky, any comments?
0
 
LVL 2

Author Comment

by:Linky
ID: 7136452
Thank you for your help all.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7138866
You're welcome.

And thanks for closing the Q and thanks for the "A" grade.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7138953
...and is there, at least, a little "thanks" to me?
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7138963
Richie, the "I agree with Richie" sentence and "Thank you for your help all." (Linky) wasn't good enough?

  OK then---thanks, Richie! :)  Muchas gracias. Merci beaucoup.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7138978
rspahitz, since answer raised from my comment, i would like a "specific" thanks from Linky, that's all!
(I just remember one comment from you in another thread ;)
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

649 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