I ended up solving my own problem... if anybody else encounters it, here is the code I used:
Thanks anyway!Code://This is the amount of time it takes to get completely red from a green starting state const int ci_SecondsToRed = 20; public DateTime LastSuccessfulPing; public Color GetStatusColor() { TimeSpan t = DateTime.Now - LastSuccessfulPing; //Get the number of seconds that represents int NumberOfSeconds = Convert.ToInt32(t.Seconds); //If the number is higher than ci_SecondsToRed, make it ci_SecondsToRed (because we're not getting redder than red) if (NumberOfSeconds > ci_SecondsToRed) NumberOfSeconds = ci_SecondsToRed; //Return a color that goes from green to red over the constant number of seconds return Color.FromArgb((255/ci_SecondsToRed)*NumberOfSeconds,(255/ci_SecondsToRed)*(ci_SecondsToRed-NumberOfSeconds),0); }
Dan





Reply With Quote