b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

datagridview重叠_datagridview绑定list_datagridview右键菜单(61)

电脑杂谈  发布时间:2017-05-30 08:07:57  来源:网络整理

dataGridView1.VirtualMode = true;

dataGridView1.Columns.Insert(0, new DataGridViewCheckBoxColumn());

// Initialize the dictionary that contains the boolean check state.

checkState = new Dictionary<int, bool>();

}

private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)

{

// Update the status bar when the cell value changes.

if (e.ColumnIndex == 0 && e.RowIndex != -1)

{

// Get the orderID from the OrderID column.

int orderID = (int)dataGridView1.Rows[e.RowIndex].Cells["OrderID"].Value;

checkState[orderID] = (bool)dataGridView1.Rows[e.RowIndex].Cells[0].Value;

}

private void dataGridView1_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)

{

// Handle the notification that the value for a cell in the virtual column

// is needed. Get the value from the dictionary if the key exists.

if (e.ColumnIndex == 0)

{

int orderID = (int)dataGridView1.Rows[e.RowIndex].Cells["OrderID"].Value;

if (checkState.ContainsKey(orderID))

{

e.Value = checkState[orderID];

}

else

e.Value = false;

}

}

private void dataGridView1_CellValuePushed(object sender, DataGridViewCellValueEventArgs e)

{

// Handle the notification that the value for a cell in the virtual column

// needs to be pushed back to the dictionary.

if (e.ColumnIndex == 0)

{

// Get the orderID from the OrderID column.

int orderID = (int)dataGridView1.Rows[e.RowIndex].Cells["OrderID"].Value;

// Add or update the checked value to the dictionary depending on if the


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-50070-61.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...