F
Frozen_Nova
Guest
So, I'm Trying to write a function for the following lines of code so that I don't have to re-write it with different values every
time I have to use it.
private void Timer1_Tick(object sender, EventArgs e)
{
if (Blue >= 180)
{
timer1.Stop();
}
else
{
Blue = Blue + 3;
}
label1.ForeColor = Color.FromArgb(180, 180, blueTasksBoard);
}
So what I'm trying to do here is, when the user clicks on a button this timer will start and the Blue Property of Label1 s
ForeColor will periodically increment by 3 until it had reached 180. And I have to put this code every time I want to change
the RGB of a certain Labels Forecolor, using different timers. So I have tried to write a function that I can call to, and this is what I have so Far.
private void stoptimer(string ColorType, int ColorNumber, int incrementalValue, string Timername, string LabelName, int red, string int, string int)
{
if(Int32.Parse(ColorType) <= ColorNumber)
{
Timername.Stop(); //Gives me an error message
}
else
{
int ColorTypeInt = Int32.Parse(ColorType);
ColorTypeInt = ColorTypeInt - 3;
}
LabelName.ForeColor = Color.FromArgb(red, green, blue); //Also Gives me an Error
}
Any Suggestions on how to make a better Function?
Thank you
Continue reading...
time I have to use it.
private void Timer1_Tick(object sender, EventArgs e)
{
if (Blue >= 180)
{
timer1.Stop();
}
else
{
Blue = Blue + 3;
}
label1.ForeColor = Color.FromArgb(180, 180, blueTasksBoard);
}
So what I'm trying to do here is, when the user clicks on a button this timer will start and the Blue Property of Label1 s
ForeColor will periodically increment by 3 until it had reached 180. And I have to put this code every time I want to change
the RGB of a certain Labels Forecolor, using different timers. So I have tried to write a function that I can call to, and this is what I have so Far.
private void stoptimer(string ColorType, int ColorNumber, int incrementalValue, string Timername, string LabelName, int red, string int, string int)
{
if(Int32.Parse(ColorType) <= ColorNumber)
{
Timername.Stop(); //Gives me an error message
}
else
{
int ColorTypeInt = Int32.Parse(ColorType);
ColorTypeInt = ColorTypeInt - 3;
}
LabelName.ForeColor = Color.FromArgb(red, green, blue); //Also Gives me an Error
}
Any Suggestions on how to make a better Function?
Thank you
Continue reading...