怎样把DataGrid中的某列设为指定的颜色? http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q896qhttp://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q927q 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 DataDrowGridTextBoxColumn Col0 = new DataDrowGridTextBoxColumn(); Col0.MappingName="HouseCode"; Col0.HeaderText="合作医疗号"; Col0.Width=110; Col0.SetDrowCellColor += new DrowCellEventHandler(this.SetDGRowLineColor);重写控件#region DataDrowGridTextBoxColumn public class DataDrowGridTextBoxColumn:DataGridTextBoxColumn { //-----------11-1-- public event DrowCellEventHandler SetDrowCellColor; 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) { if(this.SetDrowCellColor!=null) { DataGridDrowCellEventArgs e = new DataGridDrowCellEventArgs(); e.Row = rowNum; this.SetDrowCellColor(this,e); backBrush = e.BackBrush; foreBrush = e.ForeBrush; //backBrush = new SolidBrush(Color.FromArgb(255, 200, 200)); } base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight); } //----------------- } #endregion 事件private void SetDGRowLineColor(参数){if(...){e.ForeBrush = new SolidBrush(Color.Red);}}QQ 15665964 winform的CheckedListBox 如何触发滚动事件 三成架构数据查询问题 SOCKET 多文件传送 FlashVars 未将对象引用设置到对象的实例的问题? \u5df2 这个是什么字 如何计算 如何把表中记录的参数名和参数值,赋值给类中的属性?? 如何存储树型结构的数据?? [Winform]在一程序内如何判断一个名为"最新公告"的窗口是否已打开?? b/s结构中怎么样记录适时的在线用户阿? INI文件写入的问题 在C#中怎样定位到一个目录呢?---请各位帮忙
Col0.MappingName="HouseCode";
Col0.HeaderText="合作医疗号";
Col0.Width=110;
Col0.SetDrowCellColor += new DrowCellEventHandler(this.SetDGRowLineColor);
重写控件
#region DataDrowGridTextBoxColumn
public class DataDrowGridTextBoxColumn:DataGridTextBoxColumn
{
//-----------11-1--
public event DrowCellEventHandler SetDrowCellColor; 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)
{
if(this.SetDrowCellColor!=null)
{
DataGridDrowCellEventArgs e = new DataGridDrowCellEventArgs();
e.Row = rowNum;
this.SetDrowCellColor(this,e);
backBrush = e.BackBrush;
foreBrush = e.ForeBrush;
//backBrush = new SolidBrush(Color.FromArgb(255, 200, 200));
}
base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight);
}
//-----------------
}
#endregion
private void SetDGRowLineColor(参数)
{
if(...)
{
e.ForeBrush = new SolidBrush(Color.Red);
}
}QQ 15665964