ArcGISCompare.frmMaster.lbSrcAttributes_DrawItem C# (CSharp) Method

lbSrcAttributes_DrawItem() private method

private lbSrcAttributes_DrawItem ( object sender, DrawItemEventArgs e ) : void
sender object
e DrawItemEventArgs
return void
        void lbSrcAttributes_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index >= 0)
            {
                AttributeData ItemToAdd = (AttributeData)lbSrcAttributes.Items[e.Index];
                Color CurrentListColor = (ItemToAdd.recordCount > 0) ? Color.Black : Color.Red;
                CurrentListColor = (ItemToAdd.numMappings > 0) ? Color.Blue : Color.Black;
                e.DrawBackground();

                if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
                {
                    Graphics g = e.Graphics;
                    g.FillRectangle(new SolidBrush(Color.Silver), e.Bounds);
                }

                e.DrawFocusRectangle();
                e.Graphics.DrawString(((String)lbSrcAttributes.Items[e.Index].ToString()), this.Font, new SolidBrush(CurrentListColor), e.Bounds);
            }
        }