Originally posted by Ali
Hey, I've been trying to figure out a way to make the title of my Form1 flash.
I've seen a post before about this and it works for components and i would like to know if it is able to be done with the title of the form.
I've heard it is possible to do so but i cant figure out how.
I've tried multiple ways to try get around it but i still get an error.
You must login or register to view this content.
It is a Metro style form, i don't know if that's necessary to say but it'd be better to state so.
What I have done in code for this function to work is...
You must login or register to view this content.
This is basically when the application starts the timer (timer2) starts for the colour changing function.
Ignore the Textbox limit code.
You must login or register to view this content.
This is the type of colours that randomly come.
The last line is supposed to mean that the default fore colour of the form are the colours from the ARGB (the lines above) but im not able to do so and im not able to somehow get around this.
Maybe it's the style of the code or i may have put things in the wrong place.
- Thanks
This is my idea
You can change the text form to whatever you like, but it's impossible as i remmember to change the color of it
So, you should just use a label.
Instead of copying and pasting code il explain you how it works:
First you need to define a definition of Random so
Random Rand /*Or any other name*/ = new Random()
Now to define the random color
int A = Rand.Next(200, 255); //Will generate a random number beetwen 200 to 255
int R = Rand.Next(0, 255); //Will generate a random number beetwen 0 to 255
int G = Rand.Next(0, 255); //Will generate a random number beetwen 0 to 255
int B = Rand.Next(0, 255); //Will generate a random number beetwen 0 to 255
A it's the opacity of the label (0 = None, 255 = Full) So i recommended to use a number beetwen 200 to 255 so the label will be visible enough to understand.
Next just put the label name color
YourLabel.ForeColor = Color.FromArbg(A,R,G,B);
You can change the numbers of the random numbers to whatever you like, than it will generate other colors
Make sure you put the Random definition
outside of the timer void loop (So it will be global variable) than it wont need to make a new definition of the Random everytime that the loop ends.