protected override Size OnMeasureSubItem(SubItemMeasureEventArgs measureEventArgs) { switch ((ColumnId)measureEventArgs.SubItemId) { case ColumnId.Id: return(measureEventArgs.MeasureText(DataContext.Id.ToString())); case ColumnId.Name: case ColumnId.Subject: return(measureEventArgs.MeasureText(DataContext.Subject)); case ColumnId.Author: return(MeasureOptionalContent(DataContext.Author, measureEventArgs)); case ColumnId.AssignedTo: return(MeasureOptionalContent(DataContext.AssignedTo, measureEventArgs)); case ColumnId.Tracker: return(MeasureOptionalContent(DataContext.Tracker, measureEventArgs)); case ColumnId.Priority: return(MeasureOptionalContent(DataContext.Priority, measureEventArgs)); case ColumnId.Project: return(MeasureOptionalContent(DataContext.Project, measureEventArgs)); case ColumnId.Status: return(MeasureOptionalContent(DataContext.Status, measureEventArgs)); case ColumnId.Category: return(MeasureOptionalContent(DataContext.Category, measureEventArgs)); case ColumnId.CreatedOn: return(IssueCreatedOnColumn.OnMeasureSubItem(measureEventArgs, DataContext.CreatedOn)); case ColumnId.UpdatedOn: return(IssueUpdatedOnColumn.OnMeasureSubItem(measureEventArgs, DataContext.UpdatedOn)); case ColumnId.StartDate: return(MeasureOptionalContent(DataContext.StartDate, measureEventArgs)); case ColumnId.DueDate: return(MeasureOptionalContent(DataContext.DueDate, measureEventArgs)); case ColumnId.DoneRatio: return(new Size(60, 1)); default: if (measureEventArgs.SubItemId >= (int)ColumnId.CustomFieldOffset) { var cfid = measureEventArgs.SubItemId - (int)ColumnId.CustomFieldOffset; return(MeasureOptionalContent(DataContext.CustomFields[cfid], measureEventArgs)); } else { return(base.MeasureSubItem(measureEventArgs)); } } }
protected override void OnPaintSubItem(SubItemPaintEventArgs paintEventArgs) { switch ((ColumnId)paintEventArgs.SubItemId) { case ColumnId.Id: paintEventArgs.PaintText(DataContext.Id.ToString()); break; case ColumnId.Name: case ColumnId.Subject: paintEventArgs.PaintText(DataContext.Subject); break; case ColumnId.Author: RedmineGuiUtility.PaintOptionalContent(DataContext.Author, paintEventArgs); break; case ColumnId.AssignedTo: RedmineGuiUtility.PaintOptionalContent(DataContext.AssignedTo, paintEventArgs); break; case ColumnId.Tracker: RedmineGuiUtility.PaintOptionalContent(DataContext.Tracker, paintEventArgs); break; case ColumnId.Priority: RedmineGuiUtility.PaintOptionalContent(DataContext.Priority, paintEventArgs); break; case ColumnId.Project: RedmineGuiUtility.PaintOptionalContent(DataContext.Project, paintEventArgs); break; case ColumnId.Status: RedmineGuiUtility.PaintOptionalContent(DataContext.Status, paintEventArgs); break; case ColumnId.Category: RedmineGuiUtility.PaintOptionalContent(DataContext.Category, paintEventArgs); break; case ColumnId.CreatedOn: IssueCreatedOnColumn.OnPaintSubItem(paintEventArgs, DataContext.CreatedOn); break; case ColumnId.UpdatedOn: IssueUpdatedOnColumn.OnPaintSubItem(paintEventArgs, DataContext.UpdatedOn); break; case ColumnId.StartDate: RedmineGuiUtility.PaintOptionalContent(DataContext.StartDate, paintEventArgs); break; case ColumnId.DueDate: RedmineGuiUtility.PaintOptionalContent(DataContext.DueDate, paintEventArgs); break; case ColumnId.DoneRatio: var r = paintEventArgs.Bounds; r.Inflate(-4, -8); paintEventArgs.Graphics.FillRectangle(Brushes.LightBlue, r); if (DataContext.DoneRatio != 0) { var w = (int)(r.Width * DataContext.DoneRatio / 100); r.Width = w; paintEventArgs.Graphics.FillRectangle(Brushes.Blue, r); } break; default: if (paintEventArgs.SubItemId >= (int)ColumnId.CustomFieldOffset) { var cfid = paintEventArgs.SubItemId - (int)ColumnId.CustomFieldOffset; RedmineGuiUtility.PaintOptionalContent(DataContext.CustomFields[cfid], paintEventArgs); } break; } }