Ejemplo n.º 1
0
        protected override void OnRowPostPaint(DataGridViewRowPostPaintEventArgs e)
        {
            if (this.RowHeadersVisible == true)  //行头列可见
            {
                if (m_ShowTriangleMark == false) //不显示行头的三角指示符
                {
                    Color Cellcolor;
                    var   rect1 = new Rectangle(e.RowBounds.Left + 1, e.RowBounds.Top + 1, this.RowHeadersWidth - 2, e.RowBounds.Height - 2);
                    if (this.SelectedRows.Count > 0 && this.SelectedRows.Contains(this.Rows[e.RowIndex]))
                    {
                        Cellcolor = this.RowHeadersDefaultCellStyle.SelectionBackColor;
                    }
                    else
                    {
                        Cellcolor = this.RowHeadersDefaultCellStyle.BackColor;
                    }

                    using (Brush b = new SolidBrush(Cellcolor))
                    {
                        e.Graphics.FillRectangle(b, rect1);
                    }
                }

                //显示行头序列号
                if (m_ShowRowNo == true)
                {
                    ControlThemeDataGridView.RowPostPaint_HeaderCount(this, e);
                }
            }
        }