File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,8 +31,24 @@ public override Font Font
3131
3232 protected override void OnCellFormatting ( DataGridViewCellFormattingEventArgs e )
3333 {
34- e . CellStyle . Font = e . Value == DBNull . Value ? italicFont : normalFont ;
35- e . CellStyle . ForeColor = e . Value == DBNull . Value ? SystemColors . GrayText : SystemColors . WindowText ;
34+ if ( e . Value == DBNull . Value )
35+ {
36+ e . CellStyle . Font = italicFont ;
37+ e . CellStyle . ForeColor = SystemColors . GrayText ;
38+ }
39+ else
40+ {
41+ e . CellStyle . Font = normalFont ;
42+ e . CellStyle . ForeColor = SystemColors . WindowText ;
43+
44+ // Format DateTime values to include seconds
45+ if ( e . Value is DateTime dateTimeValue )
46+ {
47+ e . Value = dateTimeValue . ToString ( "yyyy-MM-dd HH:mm:ss" ) ;
48+ e . FormattingApplied = true ;
49+ }
50+ }
51+
3652 base . OnCellFormatting ( e ) ;
3753 }
3854
You can’t perform that action at this time.
0 commit comments