向Excel学习,如何让DataGridView(WinForm)实现Excel的一个功能 本帖最后由 chong4r 于 2010-06-03 16:46:01 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以的啊!你可以在RowCommon事件中 加生成一个随机的单元格,然后加样式 this.dataGridView1.CellFormatting += dataGridView1_CellFormatting; private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if(e.RowIndex == dataGridView1.CurrentCell.RowIndex && e.ColumnIndex == dataGridView1.CurrentCell.ColumnIndex) { e.CellStyle.SelectionBackColor = Color.DarkBlue; } else { e.CellStyle.SelectionBackColor = this.dataGridView1.DefaultCellStyle.SelectionBackColor; } }设置选中的颜色 又一个正则问题 sqlserver 数据库 怎么获取文件夹下的选择的文件的路径(急啊。。。。在线等) 急 帮忙看下什么意思 gridview中的問題 C++转成C# 求正则表达式 如何让TextBox中只能输入数字,用Keypress 在线等待:如何通过app.config配置来自动寻找应用程序所需的数据库?谢谢! label与timer结合实现的问题 关于C#操作word的问题 一个好简单的问题
生成一个随机的单元格,然后加样式
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if(e.RowIndex == dataGridView1.CurrentCell.RowIndex && e.ColumnIndex == dataGridView1.CurrentCell.ColumnIndex)
{
e.CellStyle.SelectionBackColor = Color.DarkBlue;
}
else
{
e.CellStyle.SelectionBackColor = this.dataGridView1.DefaultCellStyle.SelectionBackColor;
}
}设置选中的颜色