DataGrid 属性有CSSCLASS,好像引入带有Backgroud的CSS文件是可以的,不过我也具体记不太清了
解决方案 »
- 注销后点“后退”又回到注销前的页面。
- 求手机号码验证正则表达式
- WinForm 如何判断操作系统的UI语言?
- 请问如何利用已知的type来实现未知类型数据的比较??
- 机器自动换外网IP
- 在IE上展现智能客户端,智能客户端用Remoting与IIS通信实现聊天程序,求解决方案!
- 一个DataSet的更新问题,帮帮小弟,跪谢了!!
- ListBox数据绑定以后出现了麻烦,请大家帮忙。
- 利用.Net IDE
- .net 后台怎么获取点击button的值
- dll(delphi的)里面有一个窗体,我想把它调出来,显示在c#的一个panel上怎么办?
- 如何保证Form1调用Form2进行提醒后不自动关闭Form2
是有用的,不过如果你设置了行的颜色,就遮住了。
是有用的,不过如果你设置了行的颜色,就遮住了。
我自己做了一个继承自DataGrid的grid类,重载BackgroundImage属性后,发现设置这个属性没有用,不知道是否象楼上说的...后来又试了一下重载OnPaint、OnPaintBackground等方法,用Reflector.exe看了一下DataGrid的OnPaint()方法,不知从何入手,哪位大侠能帮解释一下下面的代码,里面好多东西都是受保护级别的,要如何来用 protected override void OnPaint(PaintEventArgs pe)
{
try
{
this.CheckHierarchyState();
if (this.layout.dirty)
{
this.ComputeLayout();
}
Graphics graphics1 = pe.Graphics;
Region region1 = graphics1.Clip;
if (this.layout.CaptionVisible)
{
this.caption.Paint(graphics1, this.layout.Caption, this.isRightToLeft());
}
if (this.layout.ParentRowsVisible)
{
graphics1.FillRectangle(SystemBrushes.AppWorkspace, this.layout.ParentRows);
this.parentRows.Paint(graphics1, this.layout.ParentRows, this.isRightToLeft());
}
Rectangle rectangle1 = this.layout.Data;
if (this.layout.RowHeadersVisible)
{
rectangle1 = Rectangle.Union(rectangle1, this.layout.RowHeaders);
}
if (this.layout.ColumnHeadersVisible)
{
rectangle1 = Rectangle.Union(rectangle1, this.layout.ColumnHeaders);
}
graphics1.SetClip(rectangle1);
this.PaintGrid(graphics1, rectangle1);
graphics1.Clip = region1;
region1.Dispose();
this.PaintBorder(graphics1, this.layout.ClientRectangle);
graphics1.FillRectangle(DataGrid.DefaultHeaderBackBrush, this.layout.ResizeBoxRect);
base.OnPaint(pe);
}
catch (Exception)
{
if ((this.Site == null) || !this.Site.DesignMode)
{
throw;
}
this.gridState[0x800000] = true;
try
{
bool flag1;
MessageBox.Show(SR.GetString("DataGridExceptionInPaint"));
base.BeginUpdateInternal();
this.parentRows.Clear();
this.caption.BackButtonVisible = flag1 = false;
this.caption.DownButtonActive = flag1 = flag1;
this.caption.BackButtonActive = flag1;
this.caption.SetDownButtonDirection(!this.layout.ParentRowsVisible);
this.originalState = null;
this.Set_ListManager(null, string.Empty, true);
return;
}
finally
{
this.gridState[0x800000] = false;
base.EndUpdateInternal();
}
}
}
顺便问一下,不知道大家做项目时用的什么grid控件?