private void olvComplex_FormatCell(object sender, FormatCellEventArgs e) { Person p = (Person)e.Model; // Put a love heart next to Nicola's name :) if (e.ColumnIndex == 0) { if (e.SubItem.Text.ToLowerInvariant().StartsWith("nicola")) { e.SubItem.Decoration = new ImageDecoration(Resource1.loveheart, 64); } else { e.SubItem.Decoration = null; } } // If the occupation is missing a value, put a composite decoration over it // to draw attention to. if (e.ColumnIndex == 1 && e.SubItem.Text == "") { TextDecoration decoration = new TextDecoration("Missing!", 255); decoration.Alignment = ContentAlignment.MiddleCenter; decoration.Font = new Font(this.Font.Name, this.Font.SizeInPoints + 2); decoration.TextColor = Color.Firebrick; decoration.Rotation = -20; e.SubItem.Decoration = decoration; CellBorderDecoration cbd = new CellBorderDecoration(); cbd.BorderPen = new Pen(Color.FromArgb(128, Color.Firebrick)); cbd.FillBrush = null; cbd.CornerRounding = 4.0f; e.SubItem.Decorations.Add(cbd); } }
protected override void OnCreateControl() { base.OnCreateControl(); var _themeManager = ThemeManager.getInstance(); if (!_themeManager.ActiveAndExtended) { return; } //List back color BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Background"); ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Foreground"); //Selected item SelectedBackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Selected_Background"); SelectedForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Selected_Foreground"); //Header style HeaderUsesThemes = false; var headerStylo = new HeaderFormatStyle { Normal = { BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Header_Background"), ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Header_Foreground") } }; HeaderFormatStyle = headerStylo; //Border style if (DecorateLines) { UseCellFormatEvents = true; GridLines = false; deco = new CellBorderDecoration { BorderPen = new Pen(_themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Border")), FillBrush = null, BoundsPadding = Size.Empty, CornerRounding = 0 }; FormatCell += NGListView_FormatCell; } if (Items != null && Items.Count != 0) { BuildList(); } Invalidate(); }