winform,怎么实现把鼠标放在gridview表头的一列上,表头单元格变颜色 winform,怎么实现把鼠标放在gridview表头的一列上,表头单元格变颜色 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 void gridview_CellMouseEnter(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) DoWhatYouWant(); } 下面报错,索引超出范围。必须为非负值并小于集合大小。void gridview1_CellMouseEnter(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { gridview1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.Green; }} 你说的 索引超出范围问题这样解决:private void dataGridView1_CellMouseEnter(object sender, DataGridViewCellEventArgs e) { dataGridView1.Rows[e.RowIndex -1].Cells[e.ColumnIndex].Style.BackColor = Color.Red; } 如何从数据库中选择出的数据是按照id顺序输出 第三次发贴:vs05向导生成的DataSet如何使用参数??? 对ListView的一点疑惑 C# 关于内存污染的 VS.net2003 支持Framework2.0嗎﹖ 求一个C#多项式运算的代码!!哥哥姐姐帮忙一下。。 能否用C#开发一个类似QQ的通讯软件?? 调用非托管代码问题,望高手解救! 为什么文本框获取焦点后的事件不停的在循环? 微信开发C# 使用ADO.NET实体框架比直接用ADO.NET字符串连接数据库强在哪里呢? 小票打印机
void gridview_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
DoWhatYouWant();
}
void gridview1_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
{
gridview1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.Green;
}
}
private void dataGridView1_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
dataGridView1.Rows[e.RowIndex -1].Cells[e.ColumnIndex].Style.BackColor = Color.Red;
}