Click here to Skip to main content
15,893,381 members
Home / Discussions / C#
   

C#

 
AnswerRe: Random Image Generator [modified] Pin
Not Active22-Mar-10 14:26
mentorNot Active22-Mar-10 14:26 
GeneralRe: Random Image Generator Pin
Luc Pattyn22-Mar-10 14:45
sitebuilderLuc Pattyn22-Mar-10 14:45 
GeneralRe: Random Image Generator Pin
Not Active22-Mar-10 15:08
mentorNot Active22-Mar-10 15:08 
AnswerRe: Random Image Generator PinPopular
Luc Pattyn22-Mar-10 14:28
sitebuilderLuc Pattyn22-Mar-10 14:28 
AnswerRe: Random Image Generator Pin
DaveyM6922-Mar-10 15:06
professionalDaveyM6922-Mar-10 15:06 
AnswerRe: Random Image Generator Pin
PIEBALDconsult22-Mar-10 15:45
mvePIEBALDconsult22-Mar-10 15:45 
GeneralRe: Random Image Generator Pin
CDP180222-Mar-10 21:38
CDP180222-Mar-10 21:38 
AnswerRe: Random Image Generator Pin
koleraba23-Mar-10 2:16
koleraba23-Mar-10 2:16 
Hi
I would try the following approach. Create the class in which you store the bitmap and a boolean field, which tells you if the image was already shown:

public class ImageItem
{
    private Bitmap _image;
    public bool Shown{get;set;}

    public ImageItem(Bitmap image)
    {
        _image = image;
        Shown = false;
    }
}

private void timer1_Tick(object sender, EventArgs e)
{
    if(images.Any(image => image.Shown == false))
    {
         nextImage()
    }
    //You shown all the images
    else
    {
        //quit.
    }
}

private void nextImage(Bitmap image)
{
    int randNumber;
    do
    {
        randNumber = RandomNumber(0, 29);
    }while(images[randNumber].Shown != false)
    images[randNumber].Shown = true;
    imageArea.Image = images[randNumber];
}


I typed the code directly to the page(without visual studio) so I hope I didn't make any typos.

Uros
GeneralRe: Random Image Generator Pin
Not Active23-Mar-10 2:31
mentorNot Active23-Mar-10 2:31 
GeneralRe: Random Image Generator Pin
koleraba23-Mar-10 2:36
koleraba23-Mar-10 2:36 
QuestionAn array of bitmaps Pin
sebogawa22-Mar-10 13:40
sebogawa22-Mar-10 13:40 
AnswerRe: An array of bitmaps Pin
DaveyM6922-Mar-10 13:42
professionalDaveyM6922-Mar-10 13:42 
AnswerRe: An array of bitmaps Pin
Luc Pattyn22-Mar-10 14:25
sitebuilderLuc Pattyn22-Mar-10 14:25 
GeneralRe: An array of bitmaps Pin
Not Active22-Mar-10 14:29
mentorNot Active22-Mar-10 14:29 
GeneralRe: An array of bitmaps Pin
Luc Pattyn22-Mar-10 14:40
sitebuilderLuc Pattyn22-Mar-10 14:40 
Questionlock the application for the process [modified] Pin
Jassim Rahma22-Mar-10 12:04
Jassim Rahma22-Mar-10 12:04 
AnswerRe: lack the application for the process Pin
Not Active22-Mar-10 12:29
mentorNot Active22-Mar-10 12:29 
GeneralRe: lack the application for the process Pin
Jassim Rahma23-Mar-10 4:00
Jassim Rahma23-Mar-10 4:00 
GeneralRe: lack the application for the process Pin
Not Active23-Mar-10 4:17
mentorNot Active23-Mar-10 4:17 
Questioncall private void btnSave_Click(object sender, EventArgs e) Pin
Jassim Rahma22-Mar-10 11:58
Jassim Rahma22-Mar-10 11:58 
AnswerRe: call private void btnSave_Click(object sender, EventArgs e) Pin
Kristian Sixhøj22-Mar-10 12:02
Kristian Sixhøj22-Mar-10 12:02 
AnswerRe: call private void btnSave_Click(object sender, EventArgs e) Pin
ricmil4222-Mar-10 12:04
ricmil4222-Mar-10 12:04 
AnswerRe: call private void btnSave_Click(object sender, EventArgs e) Pin
Luc Pattyn22-Mar-10 14:47
sitebuilderLuc Pattyn22-Mar-10 14:47 
GeneralRe: call private void btnSave_Click(object sender, EventArgs e) Pin
ricmil4223-Mar-10 3:26
ricmil4223-Mar-10 3:26 
AnswerRe: call private void btnSave_Click(object sender, EventArgs e) [modified] Pin
DaveyM6922-Mar-10 12:35
professionalDaveyM6922-Mar-10 12:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.