CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2000
    Posts
    129

    Question Does anyone have a class or an algorithm that will generate a new color on every call

    Please Help!
    Does anyone have a class or an algorithm that would generate a new color (RGB) on every call.
    Thanks in advance!

  2. #2
    Join Date
    Dec 2001
    Location
    Canada/Montreal
    Posts
    983
    You can just use a loop to create different colors:
    Something like:

    PHP Code:
    int color 0;
    for( 
    int i=0;i<200;i++)
    {
         
    color+=79;
         
    COLORREFCOLOR=RGB(color+(color/10),color+10,color-10);


    I Hope this will help you !
    cheers, Sonu
    Sonu [MVP, MCAD.NET]
    Website: http://DotNetSlackers.com

  3. #3
    Join Date
    Jul 2002
    Location
    Ireland
    Posts
    5
    I have not tried this but it should be fairly close.

    PHP Code:
        int array[3];
        
    int i 0;
        
    srand( (unsigned)timeNULL ) );

        
    int i_count 0;
        while( 
    i_count )
        {
            
    rand();
            if(
    255 && 0)
            {
                array[
    i_count] = i;
                
    i_count++;
            }
            
        } 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured