/// <summary> /// Draws a line of the content. /// </summary> /// <param name="e">Event arguments.</param> protected virtual void OnDrawLine(DrawNodeLineEventArgs e) { DrawLine?.Invoke(this, e); if (e.Handled) { return; } var eContent = new GetLineContentsEventArgs(e.Node, e.LineIndex, Color.Empty); OnGetLineContents(eContent); if (eContent.ShowBar) { // Free space indicator using (Brush bBarBack = new SolidBrush(BarBackColor)) using (Brush bBarFill = new SolidBrush(!eContent.Color.IsEmpty ? eContent.Color : eContent.BarPercentage > BarCriticalPercentage ? BarCriticalFillColor : BarFillColor)) using (Pen pBarBorder = new Pen(BarBorderColor)) { e.Graphics.FillRectangle(bBarBack, e.Bounds); e.Graphics.FillRectangle(bBarFill, new RectangleF(e.Bounds.Left, e.Bounds.Top, e.Bounds.Width * eContent.BarPercentage, e.Bounds.Height)); e.Graphics.DrawRectangle(pBarBorder, Utility.ToRectangle(e.Bounds)); } } else { using (Brush brush = new SolidBrush(!eContent.Color.IsEmpty ? eContent.Color : e.LineIndex == 0 ? ForeColor : DetailTextColor)) using (StringFormat stringFormat = new StringFormat()) { e.Graphics.DrawString(eContent.Contents, Font, brush, e.Bounds, stringFormat); } } }
/// <summary> /// Gets the contents of a line of text of an item. /// </summary> /// <param name="e">Event arguments.</param> protected virtual void OnGetLineContents(GetLineContentsEventArgs e) { GetLineContents?.Invoke(this, e); }