public virtual void DrawHeader(Graphics dc, Rectangle cellRect, TreeListColumn column, TreeList.TextFormatting format, bool isHot) { if (!Application.RenderWithVisualStyles) { ControlPaint.DrawButton(dc, cellRect, ButtonState.Flat); return; } VisualStyleElement element = VisualStyleElement.Header.Item.Normal; if (isHot) { element = VisualStyleElement.Header.Item.Hot; } if (VisualStyleRenderer.IsElementDefined(element)) { VisualStyleRenderer renderer = new VisualStyleRenderer(element); renderer.DrawBackground(dc, cellRect); if (format.BackColor != Color.Transparent) { SolidBrush brush = new SolidBrush(format.BackColor); dc.FillRectangle(brush, cellRect); brush.Dispose(); } ControlPaint.DrawBorder(dc, cellRect, format.BackColor, ButtonBorderStyle.Outset); //ControlPaint.DrawButton(dc, cellRect, ButtonState.Normal); cellRect = global::TreeList.Util.AdjustRectangle(cellRect, format.Padding); //dc.DrawRectangle(Pens.Black, cellRect); Color color = format.ForeColor; TextFormatFlags flags = TextFormatFlags.EndEllipsis | format.GetFormattingFlags(); TextRenderer.DrawText(dc, column.Caption, column.Font, cellRect, color, flags); } }
public virtual void PaintCell(Graphics dc, Rectangle cellRect, Node node, TreeListColumn column, TreeList.TextFormatting format, object data) { if (format.BackColor != Color.Transparent) { Rectangle r = cellRect; r.X = column.CalculatedRect.X; r.Width = column.CalculatedRect.Width; SolidBrush brush = new SolidBrush(format.BackColor); dc.FillRectangle(brush, r); brush.Dispose(); } if (data != null) { cellRect = global::TreeList.Util.AdjustRectangle(cellRect, format.Padding); //dc.DrawRectangle(Pens.Black, cellRect); Color color = format.ForeColor; if (m_owner.FocusedNode == node && Application.RenderWithVisualStyles == false) { color = SystemColors.HighlightText; } TextFormatFlags flags = TextFormatFlags.EndEllipsis | format.GetFormattingFlags(); TextRenderer.DrawText(dc, data.ToString(), m_owner.Font, cellRect, color, flags); } }