0

我正在寻找可以表示以下值的第三方开源或商业 WinForms 控件:

任务的总持续时间。
时间流逝。
剩余时间。

一直没能找到。

4

2 回答 2

4

In the System.Diagnostic Namespace there is a Stopwatch Class, you should be able to use this to create your own control.

A Stopwatch instance can measure elapsed time for one interval, or the total of elapsed time across multiple intervals. In a typical Stopwatch scenario, you call the Start method, then eventually call the Stop method, and then you check elapsed time using the Elapsed property.

于 2012-04-10T03:04:21.477 回答
0

Infragistics 在 Winforms 中非常受欢迎,并且可以选择 DateTimePicker

... setting the MaskInput to {time} should get the behavior you are looking for. 
If you only set the FormatString property, the the time will display only when 
the control is in edit mode (when the cursor is in the control).

来自http://forums.infragistics.com/forums/t/4172.aspx

但我认为第三方将获得报酬。

如果您正在寻找 Windows 内部控件 DatePicker 有一个属性 Format 可以设置为时间。请务必将 ShowUpDown 设置为 True。

或者

this.dateTimePicker1.CustomFormat = "hh:mm";
this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom;

…………

private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
    MessageBox.Show(dateTimePicker1.Value.TimeOfDay.ToString());
}
于 2012-04-10T02:56:59.833 回答