Exemplo n.º 1
0
        private void SetRowColor_Evt(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            if (dgv == null)
            {
                return;
            }
            DataGridViewRow row = dgv.Rows[e.RowIndex];

            if (DGViewUtil.IsRowSelected(dgv, CheckBoxIndex, e.RowIndex))
            {
                SetColor(row.DefaultCellStyle, selColor);
            }
            else
            {
                if (e.RowIndex % 2 == 0)
                {
                    SetColor(row.DefaultCellStyle, defColor);
                }
                else
                {
                    SetColor(row.DefaultCellStyle, altColor);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 某行是否已选择
 /// </summary>
 /// <param name="rowIndex"></param>
 /// <returns></returns>
 public bool IsRowSelected(int rowIndex)
 {
     return(DGViewUtil.IsRowSelected(myDGV, CheckBoxIndex, rowIndex));
 }