GridViewTextBoxColumn txtColumnDay = new GridViewTextBoxColumn(); txtColumnDay.Name = "Days"; txtColumnDay.FieldName = "monthdays"; txtColumnDay.HeaderText = "monthdays"; txtColumnDay.Width = 60; txtColumnDay.TextAlignment = ContentAlignment.MiddleCenter; txtColumnDay.AutoSizeMode = BestFitColumnMode.None; dataGridView1.MasterTemplate.Columns.Add(txtColumnDay); GridViewMaskBoxColumn maskBoxColumnDay = new GridViewMaskBoxColumn(); maskBoxColumnDay.Name = "Time"; maskBoxColumnDay.FieldName = "UnitTime"; maskBoxColumnDay.HeaderText = "Time"; maskBoxColumnDay.MaskType = MaskType.Standard; maskBoxColumnDay.Mask = "00:00"; maskBoxColumnDay.TextAlignment = ContentAlignment.BottomRight; maskBoxColumnDay.FormatString = "{00:00}"; maskBoxColumnDay.DataType = typeof(TimeSpan); maskBoxColumnDay.Width = 60; maskBoxColumnDay.TextAlignment = ContentAlignment.MiddleCenter; maskBoxColumnDay.AutoSizeMode = BestFitColumnMode.None; dataGridView1.MasterTemplate.Columns.Add(maskBoxColumnDay);
DataTable dt = new DataTable(); dt.Columns.Add("monthdays"); dt.Columns.Add("UnitTime"); dt.Rows.Add("monday","00:44"); dt.Rows.Add("monday","20:44"); dataGridView1.DataSource = dt;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)