public override void PaintColumnHeaderItem(NTreeListPaintContext context, NTreeListColumnHeader item) { PaintCustomBackground(context, item); item.PaintContent(context); PaintSortGlyph(context, item); }
void PaintCustomBackground(NTreeListPaintContext context, NTreeListColumnHeader item) { NRectangle bounds = context.PaintBounds; bounds.Inflate(0, -1); Rectangle gdiRect = bounds.ToRectangle(); Color c1 = Color.Empty; Color c2 = Color.Empty; switch (item.VisualState) { case ItemVisualState.Normal: c1 = Color.FloralWhite; c2 = Color.Chocolate; break; case ItemVisualState.Hot: c1 = Color.Orange; c2 = Color.Red; break; case ItemVisualState.Pressed: c1 = Color.Red; c2 = Color.Orange; break; } LinearGradientBrush br = new LinearGradientBrush(gdiRect, c1, c2, 90F); context.Graphics.FillRectangle(br, gdiRect); br.Dispose(); if (item.Owner.VisibleIndex == 0) { return; } Pen p = new Pen(Color.Black); context.Graphics.DrawLine(p, bounds.X - 1, bounds.Y + 3, bounds.X - 1, bounds.Bottom - 4); p.Color = Color.Wheat; context.Graphics.DrawLine(p, bounds.X, bounds.Y + 4, bounds.X, bounds.Bottom - 3); p.Dispose(); }
public override void PostPaintItem(NTreeListNodeSubItem item, NTreeListPaintContext context) { Font orig = context.Font; Font newFont = null; NRectangle bounds = context.TreeList.GetSubItemRect(item); switch (item.ItemType) { case TreeListNodeSubItemType.String: if (item.Owner.IsEven) { newFont = new Font(orig, FontStyle.Strikeout); } else { newFont = new Font(orig, FontStyle.Italic); } break; case TreeListNodeSubItemType.Numeric: case TreeListNodeSubItemType.DateTime: if (item.Owner.IsEven == false) { newFont = new Font(orig, FontStyle.Strikeout); } else { newFont = new Font(orig, FontStyle.Italic); } break; } if (newFont != null) { context.Font = newFont; } base.PostPaintItem(item, context); if (newFont != null) { newFont.Dispose(); } context.Font = orig; }
public override void PrePaintItem(NTreeListNodeSubItem item, NTreeListPaintContext context) { Rectangle bounds = context.TreeList.GetSubItemRect(item).ToRectangle(); Rectangle brushRect = bounds; brushRect.Inflate(1, 1); switch (item.ItemType) { case TreeListNodeSubItemType.String: if (item.Owner.IsEven) { context.Graphics.FillEllipse(Brushes.Cyan, bounds); } else { context.Graphics.FillEllipse(Brushes.Coral, bounds); } return; case TreeListNodeSubItemType.DateTime: Color c1; Color c2; if (item.Owner.IsEven) { c1 = Color.White; c2 = Color.YellowGreen; } else { c1 = Color.Wheat; c2 = Color.Silver; } LinearGradientBrush br = new LinearGradientBrush(brushRect, c1, c2, 0F); context.Graphics.FillRectangle(br, bounds); br.Dispose(); return; } base.PrePaintItem(item, context); }