DataGridTableStyle style=new DataGridTableStyle();
style.MappingName=ds.Tables[0].TableName;
style.AlternatingBackColor=System.Drawing.Color.Lavender;;
style.MappingName=ds.Tables[0].TableName;
style.AlternatingBackColor=System.Drawing.Color.Lavender;;
解决方案 »
- 急!!c#将控制台动态输入的一组学生数据存储到数组student中怎么实现
- C# 将数据库的数据 图形化显示到windows 窗体上(折线图,柱形图都行)
- mvc下,如何构造access的数据模型。解决给100分
- [WinF]Propertygrid 如何实现更改对象的名称"(Name)"属性
- 请教一个DirectSound下顺序发音的问题
- MultiPage中添加PageView问题
- 菜鸟问个问题,请大家帮助一下!
- [郁闷]根据类的名称来构造不同的类实例?
- 怎样在MultiLine的TextBox使用Ctrl-A来全选?
- 怎样调试程序?兄弟们帮帮我!
- petshop的下载地址?
- 关于DataSet问题
{
protected override void Paint(System.Drawing.Graphics g,
System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager
source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush
foreBrush, bool alignToRight)
{
// the idea is to conditionally set the foreBrush and/or backbrush
// depending upon some crireria on the cell value
// Here, we color anything that begins with a letter higher than 'F'
try{
object o = this.GetColumnValueAtRow(source, rowNum);
if( o!= null)
{
char c = ((string)o)[0];
if( c > 'F')
{
// could be as simple as
// backBrush = new SolidBrush(Color.Pink);
// or something fancier...
backBrush = new LinearGradientBrush(bounds,
Color.FromArgb(255, 200, 200),
Color.FromArgb(128, 20, 20),
LinearGradientMode.BackwardDiagonal);
foreBrush = new SolidBrush(Color.White);
}
}
}
catch(Exception ex){ /* empty catch */ }
finally{
// make sure the base class gets called to do the drawing with
// the possibly changed brushes
base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight);
}
}
}
http://lucky_elove.www1.dotnetplayground.com/ShowList.aspx?id=1
没有我要的东西.谢谢!静待您的详细解释.先谢过!
this.dataGrid.AlternatingBackColor = System.Drawing.Color.LightGray;