|
-
Mar 31st, 2001, 07:34 PM
#1
Thread Starter
Member
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 during run-time? (by the way the random pictures must be picked up twice) e.g: picA picA, picD, picD.
-
Mar 31st, 2001, 07:38 PM
#2
How about adding them all to a ListBox, then randomly selecting a ListIndex from the listbox will result in randomly selecting a Picture.
Code:
Randomize
Num = Int(Rnd * List1.ListCount)
imgControl = LoadPicture(App.Path & "\" & List1.List(Num)
-
Mar 31st, 2001, 07:41 PM
#3
Thread Starter
Member
i only wanted the pictures stored in a folder, how can i random pick them from folder?
-
Mar 31st, 2001, 07:45 PM
#4
Frenzied Member
Name them in an arithmetic sequence (e.g. {im1, im2, im3, ...}) and
Code:
Randomize
Num = Int(Rnd * Number of Images you have)
imgControl = LoadPicture(App.path & "Im" & Num & ".gif")
Replace Im and .gif with whatever name/extension you gave the images.
[Comment - Megatron: You need to get VB6]
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|