TimePicker 用于选择一天内的时间,例如预约时间、提醒时间、工作时段等。
import win.ui;
import dotNet.AntdUI;
/*DSG{{*/
var winform = win.form(text="AntdUI TimePicker";right=380;bottom=160)
winform.add(
host={cls="custom";left=34;top=46;right=335;bottom=85;edge=1;z=1}
)
/*}}*/
var tp = AntdUI.TimePicker(winform.host);
tp.Format = "HH:mm:ss";
tp.PlaceholderText = "请选择时间";
tp.AllowClear = true;
tp.ShowButtonNow = true;
tp.DropDownArrow = true;
tp.ValueChanged = function(sender,e){
winform.text = "时间已改变";
}
winform.show();
win.loopMessage();
Value:当前时间,.NET 类型为 System.TimeSpan。Format:显示格式,例如 HH:mm:ss。PlaceholderText:占位文本。AllowClear:允许清除。ShowButtonNow:显示“此刻”按钮。DropDownArrow:显示下拉箭头。Placement:弹出位置。ValueChanged:时间变化事件。import System;
tp.Value = System.TimeSpan(9,30,0);
tp.Clear();
ValueChanged 在时间改变时触发;ClearClick 可响应用户点击清除按钮;ExpandDropChanged 可监听下拉面板展开/关闭。
Value 是 .NET TimeSpan,复杂赋值可使用 System.TimeSpan(hour,minute,second)。TimePicker 常用 ShowButtonNow 显示“此刻”按钮。