BrightIdeasSoftware.ObjectListView.ApplyRowStyle C# (CSharp) Method

ApplyRowStyle() protected method

Apply a style to the given row
protected ApplyRowStyle ( BrightIdeasSoftware.OLVListItem olvi, IItemStyle style ) : void
olvi BrightIdeasSoftware.OLVListItem
style IItemStyle
return void
        protected virtual void ApplyRowStyle(OLVListItem olvi, IItemStyle style)
        {
            if (style == null)
                return;

            if (this.FullRowSelect || this.View != View.Details) {
                if (style.Font != null)
                    olvi.Font = style.Font;

                if (style.FontStyle != FontStyle.Regular)
                    olvi.Font = new Font(olvi.Font ?? this.Font, style.FontStyle);

                if (!style.ForeColor.IsEmpty) {
                    if (olvi.UseItemStyleForSubItems)
                        olvi.ForeColor = style.ForeColor;
                    else {
                        foreach (ListViewItem.ListViewSubItem x in olvi.SubItems) {
                            x.ForeColor = style.ForeColor;
                        }
                    }
                }

                if (!style.BackColor.IsEmpty) {
                    if (olvi.UseItemStyleForSubItems)
                        olvi.BackColor = style.BackColor;
                    else {
                        foreach (ListViewItem.ListViewSubItem x in olvi.SubItems) {
                            x.BackColor = style.BackColor;
                        }
                    }
                }
            } else {
                olvi.UseItemStyleForSubItems = false;

                foreach (ListViewItem.ListViewSubItem x in olvi.SubItems) {
                    if (style.BackColor.IsEmpty)
                        x.BackColor = olvi.BackColor;
                    else
                        x.BackColor = style.BackColor;
                }

                this.ApplyCellStyle(olvi, 0, style);
            }
        }
ObjectListView