开发者

how to set the timer in c# [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answ开发者_Go百科ered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

i am drawing numerous lines in screen . i need to put timer and draw the lines in panel one by one in c# using directx


Well, I'm stabbing in the dark here because of the lack of information given, but if you're just asking for a way to time something, C# has the StopWatch class found in System.Diagnostics, it measures time in tenths of milliseconds

Usage Example:

using System.Diagnostics

public static void TestStopWatch()
{
 StopWatch sw = new StopWatch();

 int temp = 0;
 int repetitions = 1000000;

 sw.Reset();
 for (int i=0; i<repetitions; i++)
  temp++;
long time = sw.Peek();   
Console.WriteLine("Time = " + time/10.0 + " milliseconds.");
}

Example Output:

2.7 milliseconds
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜