public override void DataGridPaintColumnHeader (Graphics g, Rectangle bounds, DataGrid grid, int col)
{
// Background
g.FillRectangle (ResPool.GetSolidBrush (grid.CurrentTableStyle.HeaderBackColor), bounds);
// Paint Borders
if (!grid.FlatMode) {
g.DrawLine (ResPool.GetPen (ColorControlLightLight),
bounds.X, bounds.Y, bounds.X + bounds.Width, bounds.Y);
if (col == 0) {
g.DrawLine (ResPool.GetPen (ColorControlLightLight),
bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height);
} else {
g.DrawLine (ResPool.GetPen (ColorControlLightLight),
bounds.X, bounds.Y + 2, bounds.X, bounds.Y + bounds.Height - 3);
}
if (col == (grid.VisibleColumnCount -1)) {
g.DrawLine (ResPool.GetPen (ColorControlDark),
bounds.X + bounds.Width - 1, bounds.Y,
bounds.X + bounds.Width - 1, bounds.Y + bounds.Height);
} else {
g.DrawLine (ResPool.GetPen (ColorControlDark),
bounds.X + bounds.Width - 1, bounds.Y + 2,
bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 3);
}
g.DrawLine (ResPool.GetPen (ColorControlDark),
bounds.X, bounds.Y + bounds.Height - 1,
bounds.X + bounds.Width, bounds.Y + bounds.Height - 1);
}
bounds.X += 2;
bounds.Width -= 2;
DataGridColumnStyle style = grid.CurrentTableStyle.GridColumnStyles[col];
if (style.ArrowDrawingMode != DataGridColumnStyle.ArrowDrawing.No)
bounds.Width -= 16;
// Caption
StringFormat format = new StringFormat ();
format.FormatFlags |= StringFormatFlags.NoWrap;
format.LineAlignment = StringAlignment.Center;
format.Trimming = StringTrimming.Character;
g.DrawString (style.HeaderText, grid.CurrentTableStyle.HeaderFont,
ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderForeColor),
bounds, format);
// Arrow (6 x 6)
if (style.ArrowDrawingMode != DataGridColumnStyle.ArrowDrawing.No) {
Point pnt = new Point (bounds.X + bounds.Width + 4, bounds.Y + ((bounds.Height - 6)/2));
if (style.ArrowDrawingMode == DataGridColumnStyle.ArrowDrawing.Ascending) {
g.DrawLine (SystemPens.ControlLightLight, pnt.X + 6, pnt.Y + 6, pnt.X + 3, pnt.Y);
g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y + 6, pnt.X + 6, pnt.Y + 6);
g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y + 6, pnt.X + 3, pnt.Y);
} else {
g.DrawLine (SystemPens.ControlLightLight, pnt.X + 6, pnt.Y, pnt.X + 3, pnt.Y + 6);
g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y, pnt.X + 6, pnt.Y);
g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y, pnt.X + 3, pnt.Y + 6);
}
}
}