using System;
using System.Windows.Forms;
using System.Drawing;
namespace Rovan.Controls
{
/// <summary>
/// Rovan 的摘要说明。
/// </summary>
public class RovanDataGrid :DataGrid
{
public RovanDataGrid()
{
//
// TODO: 在此处添加构造函数逻辑
//
this.CurrentCellChanged +=new EventHandler(RovanDataGrid_CurrentCellChanged);
this.TableStyles.CollectionChanged +=new System.ComponentModel.CollectionChangeEventHandler(TableStyles_CollectionChanged);
this.BackgroundColor = Color.FromArgb(231, 240, 247);
this.RowHeaderWidth = 15;
this.HeaderBackColor = Color.FromArgb(191, 213, 236);
this.AlternatingBackColor = Color.FromArgb(231, 240, 247);
this.SelectionBackColor = System.Drawing.SystemColors.InactiveCaption;
}
private void RovanDataGrid_CurrentCellChanged(object sender, EventArgs e)
{
this.Select(this.CurrentCell.RowNumber);
}
private void TableStyles_CollectionChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e)
{
foreach(DataGridTableStyle ts in this.TableStyles)
{
ts.RowHeaderWidth = this.RowHeaderWidth;
ts.HeaderBackColor = this.HeaderBackColor;
ts.AlternatingBackColor = this.AlternatingBackColor;
ts.SelectionBackColor = this.SelectionBackColor;
}
}
}
}
浙公网安备 33010602011771号