Hi, i'm currently working on C# project and I want to make use of the Math.Round() function to display only the first to digits of a float value. Unfortunately this doesn't seem to be working for me. I haven't much experience in using the Timer class or the Math class. I may be overlooking something stupid and the solution is probably really simple (happens a lot to me).. here's the piece of code..
..using the above, the "test" or the "_t" values do not round off. Anybody have any ideas on why? Thanks in advance.
Code:
//Retrieve time and round it off.
float test = 5.123f;
_t += _tempTimer.Interval;
Math.Round(test, 2);
//Draw game time text.
e.Graphics.DrawString("Secs: " + test,
new Font(new FontFamily("Lucida Console"), 8.0f),
new SolidBrush(Color.White), new PointF(300, 10));
Comment