解决方案 »
- 请教XML的问题,送分给各位啦
- 正则表达式分析语法
- 想做个dataGridView删除选中的行,想了好久没有解决.高手指点一下
- 基于Tcp/IP的网络聊天程序,为什么客户端收不到服务器发送的数据?
- 通过Internet Explorer_Server类的句柄载入网页
- 怎么取datagridview中datagridviewcomboboxcolumn中的combobox控件
- 急急急!按照微软的标准,我的三层结构系统中,每个数据库表都需要一个数据实体?
- 怎么使用LINQ实现对List<List<string>>循环并拼接字符串
- 求教!怎样设置如下的相对路径?
- 请问在asp.net中<%@ Page Language="c#" Inherits..... 中的page是什么
- C#如何将string转换成FileStream
- sqlclient连接不上
SelectionBackColor
选择行字体颜色
SelectionForeColor
代码如下:
dataGridView1.DefaultCellStyle.SelectionBackColor = Color.Transparent;
dataGridView1.DefaultCellStyle.SelectionForeColor = Color.Red;
版主求点代码?小白不知道具体怎么实现http://www.cnblogs.com/Fooo/archive/2008/11/20/1337336.html
private void Frm_Main_Load(object sender, EventArgs e)
{
dgv_Message.DataSource = new List<Fruit>() {//绑定数据集合
new Fruit(){Name="地瓜",Price=30},
new Fruit(){Name="茄子",Price=40},
new Fruit(){Name="土豆",Price=33},
new Fruit(){Name="柿子",Price=31}};
dgv_Message.Columns[0].Width = 200;//设置列宽度
dgv_Message.Columns[1].Width = 170;//设置列宽度 dgv_Message.SelectionMode = //设置如何选择单元格
DataGridViewSelectionMode.FullRowSelect;
dgv_Message.DefaultCellStyle.SelectionForeColor//选中单元格的前景色
= Color.Blue;
dgv_Message.DefaultCellStyle.SelectionBackColor//选中单元格的背景色
= Color.LightYellow;
}