Esempio 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);
                }
            }
        }
Esempio n. 2
0
 public void SetDataGridViewTheme2(bool ShowRowNo          = false, bool ShowTriangleMark = true, string TopLeftHeaderText = "No",
                                   bool allrowusertoaddrow = false, bool allowusertodeleterows = false, int ColumnHeaderHeight = 32,
                                   int datarowHeight       = 22, bool rowheadervisible = true, bool fillsizecolumnsmode = false,
                                   bool isautosizerows     = false)
 {
     m_ShowRowNo        = ShowRowNo;
     m_ShowTriangleMark = ShowTriangleMark;
     ControlThemeDataGridView.ApplyDefaultGridViewTheme(this, TopLeftHeaderText, allrowusertoaddrow, allowusertodeleterows, ColumnHeaderHeight,
                                                        datarowHeight, rowheadervisible, fillsizecolumnsmode, isautosizerows);
 }