System.Windows.Forms.DrawListViewSubItemEventArgs.DrawBackground C# (CSharp) Method

DrawBackground() public method

public DrawBackground ( ) : void
return void
        public void DrawBackground ()
        {
		graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (subItem.BackColor), bounds);
        }

Usage Example

Example #1
0
        private void lvObjects_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            this.columnName.Width = lvObjects.Width - 16*3 - 4;

            if (e.SubItem.Tag != null)
            {
                if (e.Header == this.columnNetwork)
                {
                    e.DrawBackground();
                    var imageRect = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Height, e.Bounds.Height);
                    Image imgToDraw = e.SubItem.Tag.Equals(true) ? Resources.networkIconOn : Resources.networkIconOff;
                    e.Graphics.DrawImage(imgToDraw, imageRect);
                    e.Header.Width = 16;
                }
                else if (e.Header == this.columnPlayer)
                {
                    e.DrawBackground();
                    var imageRect = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Height, e.Bounds.Height);
                    Image imgToDraw = e.SubItem.Tag.Equals(true) ? Resources.playerIconOn : Resources.playerIconOff;
                    e.Graphics.DrawImage(imgToDraw, imageRect);
                    e.Header.Width = 16;
                }
            }

            else
            {
                e.DrawDefault = true;
                return;
            }
        }
All Usage Examples Of System.Windows.Forms.DrawListViewSubItemEventArgs::DrawBackground