zoukankan      html  css  js  c++  java
  • datagridview

    datagridview.Rows[].Cells[].value     取单元格值 

    datagridview.CurrentCell.RowIndex;是当前活动的单元格的行的索引
    DataGridView1.CurrentRow.Index 获得包含当前单元格的行的索引 
    datagridview.SelectedRows 是选中行的集合
    datagridview.SelectedColumns 是选中列的集合
    datagridview.SelectedCells 是选中单元格的集合

    datagridview.Rows[x].Selection=true 设定x行为选中状态

    datagridview.FirstDisplayedScrollingRowIndex 显示在首行的索引

    dataGridView1.Sort(dataGridView1.Columns[0], ListSortDirection.Ascending);//按列排序 dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Green; //行背景色 dataGridView1.Rows[i].Cells[i].DefaultCellStyle.BackColor = Color.Green; //单元格背景色 dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.AliceBlue;//交替(间隔)背景色 //响应DataGridView鼠标点击事件,获得行号索引 private void dataGridView1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DataGridView.HitTestInfo h = dataGridView1.HitTest(e.X, e.Y); Rowsindex=h.RowIndex; dataGridView1.ClearSelection(); dataGridView1.Rows[Rowsindex].Selected = true; } } ///////////////////////////////////////////////
  • 相关阅读:
    alpha冲刺9
    alpha冲刺8
    alpha冲刺7
    alpha冲6
    随堂小测-同学录
    alpha冲刺5
    任务3
    任务2
    任务1
    网站用户行为分析
  • 原文地址:https://www.cnblogs.com/clarklxr/p/6113207.html
Copyright © 2011-2022 走看看