Winforms & TimeSpan - Which control works best?

I create a form with winforms - and should add a value to the view and editable time. Which controls are best suited for this?

A regular edit control shows the correct value -> but it's not very nice to change the values

normal timing does not work

a masked edit control does not have a standard mask for this

Does anyone have a good idea to manage this task?

+3
source share
7 answers

For another project, I also had to edit the time interval.

, 3 /: , - , - .

//Setting the values
durationHours.Value = (Decimal)Math.Floor (data.TotalHours);
durationMin.Value = data.Minutes;
durationSeconds.Value = data.Seconds;

//Getting the values
data = new TimeSpan((int)durationHours.Value, (int)durationMin.Value, (int)durationSeconds.Value);
+2

, TextBox ComboBox, . ( + -) ( ). , : , 1-7 , , 1-60 .

ComboBoxes NumericUpDown.

, 3 4 6 , .

, .

.

+5
+5

, TimeSpan.TryParse() , .

, .

+2

- , .

WPF .

+1
+1

24 , , , DateTime , , TimeSpan.

, //. 60 /. : , .

: TimePicker. DateTime. :

  • : ; ( ) 24 .
  • ShowUpDown: True: , . - //.

. , .

, , DateTime Midnight . TimeSpan. Valug.Get. Value.Set: DateTime TimeSpan.

24 , TryParse. . , .

0
source

Source: https://habr.com/ru/post/1703501/


All Articles