feat: 新增时间输入和Alt按钮快捷键

This commit is contained in:
cyf
2026-08-15 22:26:11 +08:00
parent a65dfab897
commit 57dedb5e9d
23 changed files with 818 additions and 233 deletions
+23
View File
@@ -4244,6 +4244,29 @@ namespace Lskj.Control
RepositoryItemTimeEdit timeEdit = new RepositoryItemTimeEdit();
timeEdit.DisplayFormat.FormatString = timeEdit.EditFormat.FormatString = timeEdit.Mask.EditMask = DateFormat.Format(fieldType);
timeEdit.DisplayFormat.FormatType = timeEdit.EditFormat.FormatType = DevExpress.Utils.FormatType.Custom;
timeEdit.ParseEditValue += delegate(object sender, ConvertEditValueEventArgs e)
{
// SQL Server 的 time 字段在 DataTable 中是 TimeSpanTimeEdit 输入后返回 DateTime。
// 只转换 TimeSpan 绑定列,不改变原有 DateTime 类型列的行为。
if (gridColumn.ColumnType != typeof(TimeSpan) || e.Value == null || e.Value == DBNull.Value)
{
return;
}
if (e.Value is DateTime)
{
e.Value = ((DateTime)e.Value).TimeOfDay;
e.Handled = true;
return;
}
TimeSpan timeValue;
if (!(e.Value is TimeSpan) && TimeSpan.TryParse(e.Value.ToString(), out timeValue))
{
e.Value = timeValue;
e.Handled = true;
}
};