|
-
Dec 6th, 2011, 04:13 AM
#1
Thread Starter
Member
Showing a picture
Hi friends,
I have 6 pictures. I want some of them appear on the form by clicking command button.
The important point is the same pictures won't appear in each click.
For example,
First click, picture-1, picture-2, picture-3, picture-4 will appear
Second click, picture-3, picture-2, picture-5, picture-6 will appear
Third click picture-4, picture-5, picture-6, picture-1 will appear
etc...
How can I do this?
-
Dec 6th, 2011, 08:33 AM
#2
Re: Showing a picture
One option.
1. Declare a form-level variable at top of your form, i.e., intClickCount As Integer
2. In your button's click event something like this
Code:
Select Case intClickCount
Case 0 ' first click
intClickCount = intClickCount + 1
show pictures 1,2,3,4
Case 1 ' 2nd click
intClickCount = intClickCount + 1
show pictures 3,2,5,6
Case 2 ' 3rd click
intClickCount = 0 ' reset so we start over again on next click
show pictures 4,5,6,1
End Select
-
Dec 6th, 2011, 12:10 PM
#3
Thread Starter
Member
Re: Showing a picture
Thanks for reply but it isn't what I meant. There is a programme which will show the pictures. First time, I ran the programme. It showed 1 2 3 4 pictures, after that I closed the programme. When I ran the programme again, it will show different pictures, for example: 3 5 2 6 pictures or anything else. It doesn't matter. I want it to change the pictures, which will appear, in each running the programme
-
Dec 6th, 2011, 12:27 PM
#4
Re: Showing a picture
In that case, you want to store settings outside the program. This can be in an INI file, a database, the registry, etc. In the FAQ section, linked in my signature below, you can find examples of INI file usage
-
Dec 6th, 2011, 01:22 PM
#5
Lively Member
Re: Showing a picture
If the amount of pictures on your form will be static, then create a random array that will effectively mix up the picture every time you click the button.
-
Dec 6th, 2011, 07:11 PM
#6
PowerPoster
Re: Showing a picture
-- Question #1: Where are these Bitmaps stored??? Are they on a local disk, network disk, remote disk or even a resource file. I had the source code for a Bitmap to be shown by Resource File, but losted the code. It's only a one liner, as well...
-- Question #2: Is this some sort of Animation sequence. If so, then create the animation in the Microsoft Windows Video Editor, that comes with Windows XP SP3!!
Then that's the hard work taken out of the programming side of things...
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Dec 6th, 2011, 07:57 PM
#7
Re: Showing a picture
Sounds like all he needs is a random sequence of 4 image files selected from a list of 6. The image controls then load in 4 different images selected from 6 available files with no duplicates whenever a command button is pressed.
OP, please correct me if I am wrong.
-
Dec 6th, 2011, 09:47 PM
#8
PowerPoster
Re: Showing a picture
Then setup a animated gif with all of the different types, and then make a call to show rather one of them, at an interval of one second, or smaller than that??? That was much like what I was doing, in Video Editor for Windows XP SP3...
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Dec 8th, 2011, 04:03 PM
#9
Thread Starter
Member
Re: Showing a picture
LaVolpe ,
I want the programme to show different pictures when I run the programme. Do I need to know to do this?
bren0098,
How can I do this? Could you give an example?
ThEiMp,
Answer1, They are on my hard disc
Answer2, They are pictures not animations
Code Doc,
Yes you're right I want it to happen randomly.
ThEiMp,
Animation isn't what I want.
Thanks for replies
-
Dec 8th, 2011, 09:41 PM
#10
Re: Showing a picture
This should help get you started. Here's some code. Build four image controls in a control array (0 to 3).
Code:
Dim PicArray() As Integer
Const NumPics = 6
Private Sub Command1_Click()
'Shuffle PicArray
Dim iMin As Integer, iMax As Integer, Temp As Integer, varSwap As Integer
iMin = 1
iMax = NumPics
For i = iMax To iMin + 1 Step -1
Temp = Int((i - iMin + 1) * Rnd + iMin)
varSwap = PicArray(i)
PicArray(i) = PicArray(Temp)
PicArray(Temp) = varSwap
Next
' Suppose your 6 image files are named "Pic1.jpg", "Pic2.Jpg", etc.
' Select the first 4 integers in the shuffled array
For i = iMin To 4
Image1(i - 1).LoadPicture "" ' Clears the control
Image1(i - 1).LoadPicture "Pic" & Format$(PicArray(i), "&") & ".Jpg"
Next
End Sub
Private Sub Form_Load()
ReDim PicArray(NumPics)
For i = 1 To 6
PicArray(i) = i
Next
Randomize
End Sub
Each time you click the command button, a random selection of 4 images from your 6 files will be loaded into the image controls. I haven't tested this completely, but I believe it's time for you to take over.
Tags for this Thread
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
|