Okay so I got the original working and is fairly simple. Only problem is I can't figure out how to set it up to scroll one color section after the other. Like this pseudo code would be:

if (color1 >= 255)
{
color2++;
}

if (color2 >= 255)
{
color3++;
}

if (color >= 255)
{
color1++;
}

So I'm bringing in while loops and everything else but it's not wanting to work at all. Help is appreciated.

void colorScrollRotation(object sender, EventArgs e)
        {
            Color colorMe = agInc.ForeColor;
            Color colorMeRotation = label1.ForeColor;

            int colorRed = colorMe.R;
            int colorGreen = colorMe.G;
            int colorBlue = colorMe.B;

            int rotation = colorMeRotation.R;

            while (rotation == 0)
            {
                colorGreen++;

                if (colorGreen >= 255)
                {
                    colorGreen = 0;
                    rotation = 1;
                    label1.ForeColor = Color.FromArgb(rotation, 0, 0);
                }
            }

            while (rotation == 1)
            {
                colorRed++;

                if (colorRed >= 255)
                {
                    colorRed = 0;
                    rotation = 2;
                    label1.ForeColor = Color.FromArgb(rotation, 0, 0);
                }
            }

            while (rotation == 2)
            {
                colorBlue++;

                if (colorBlue >= 255)
                {
                    colorBlue = 0;
                    rotation = 0;
                    label1.ForeColor = Color.FromArgb(rotation, 0, 0);
                }
            }

            agInc.ForeColor = Color.FromArgb(colorRed, colorGreen, colorBlue);
            label1.ForeColor = Color.FromArgb(rotation, 0, 0);
        }

Recommended Answers

All 4 Replies

what is agInc?

It's a label on the form.

Thanks for the help everyone but I figured it out. I switched the while loops out for standard if and else if statements then just ran a simple if inside each. :)

// Example;
// Check the value of the hue rotation;
            if (rotation == 0)
            {
                colorGreen++;
                colorRed = 0;
                colorBlue = 0;

                // Check the value of green.
                if (colorGreen >= 255)
                {
                    colorGreen = 0;
                    rotation = 1; // Sets rotation for the next color;
                }
            }
            
            // Check the hue rotation value again.
            else if (rotation == 1)
            {
                    nextColor++;
            }

:) Congrats

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.