C# 如何根据numericupdown值设置计时器?
我有一个程序,有3个数字设置。他们的名字是secondsN、minutesN和hoursN。我想根据numericupdowns的值设置计时器 示例:如果secondsN的值为3,那么我希望将时钟设置为3秒,我认为是3000毫秒 那我该怎么做呢C# 如何根据numericupdown值设置计时器?,c#,timer,numericupdown,C#,Timer,Numericupdown,我有一个程序,有3个数字设置。他们的名字是secondsN、minutesN和hoursN。我想根据numericupdowns的值设置计时器 示例:如果secondsN的值为3,那么我希望将时钟设置为3秒,我认为是3000毫秒 那我该怎么做呢 谢谢你的帮助 您可以将它们组合成一个时间跨度。然后使用TotalMillimess属性 int numberOfHours, numberOfMinutes, numberOfSeconds; var timeSpan = new TimeSpan(nu
谢谢你的帮助 您可以将它们组合成一个时间跨度。然后使用TotalMillimess属性
int numberOfHours, numberOfMinutes, numberOfSeconds;
var timeSpan = new TimeSpan(numberOfHours, numberOfMinutes, numberOfSeconds);
myTimer.Interval = timeSpan.TotalMilliseconds;
您可以将它们组合成一个时间跨度。然后使用TotalMillimess属性
int numberOfHours, numberOfMinutes, numberOfSeconds;
var timeSpan = new TimeSpan(numberOfHours, numberOfMinutes, numberOfSeconds);
myTimer.Interval = timeSpan.TotalMilliseconds;
怎么样
Timespan ts = new Timespan(
Convert.ToInt32(value_from_hoursN),
Convert.ToInt32(value_from_minutesN),
Convert.ToInt32(value_from_secondsN));
Then double interval = ts.TotalMilliSeconds;
怎么样
Timespan ts = new Timespan(
Convert.ToInt32(value_from_hoursN),
Convert.ToInt32(value_from_minutesN),
Convert.ToInt32(value_from_secondsN));
Then double interval = ts.TotalMilliSeconds;