Click to See Complete Forum and Search --> : how can i generate random pictures?


ariel_au
March 31st, 2001, 11:40 AM
i am currently working a game. i draw out imageboxes named "imgControl" (using index property) in a form.
my problem is how can i generate random picked pictures that are stored in a folder and display them in the imgControl? (by the way the random pictures must be picked up twice) e.g: picA picA, picD, picD.

shree
March 31st, 2001, 07:46 PM
name you pictures pic1.bmp, pic2.bmp, etc, say upto pic10.bmp. Then in your code,


for i= 1 to 10
num = 1 + int(rnd*10)
filepath = app.path & "\pic" & num & ".bmp"
imgControl.Picture = LoadPicture (filepath)
imgControlAnother.Picture = LoadPicture(filepath)
next

ariel_au
March 31st, 2001, 08:48 PM
lets say my pic1.bmp to pic10.bmp are stored in location " C:\myfolders\picXX.bmp".

where shall i put in the "C:\myfolders\.."??

and if i am not wrong, u are including another imagebox called "imgControlAnother" right?

shree
March 31st, 2001, 09:02 PM
filepath = "C:\myfolder" & "\pic" & num &".bmp"

Yes, you wanted the same file to be used twice, didn't you? I was just trying to show that you can use it as many times, and in any way you like.

ariel_au
March 31st, 2001, 09:17 PM
thank you,

well, i draw imgControl using loops and imgControl index property is set 0.
i just wanted to random place pictures in imgControl provided that the pics must appear twice.

i am trying to attach my form here and try if i am able to do that...seems like i can't attach my program here. how can i attach my program here?? ( i am using "micosoft internet explorer")