public void OnPaint(DataGridViewCellPaintingEventArgs e) { if (_columnTextAlignMode == TextAlignModes.Center) { Graphics g = e.Graphics; Point pt = Control.MousePosition; DataGridView _parent = base.DataGridView; if (_parent == null) { return; } pt = _parent.PointToClient(pt); Brush textColor; if (e.CellBounds.Contains(pt)) { textColor = CellFunctions.DrawHeaderBack(e.CellBounds, g, _parent.GridColor, true); } else { textColor = CellFunctions.DrawHeaderBack(e.CellBounds, g, Color.WhiteSmoke, this.Selected); } //Brush textColor = CellFunctions.DrawHeaderBack(e.CellBounds,g, _parent.GridColor, this.Selected); pt = CellFunctions.TextCenterInRact(e.CellBounds, g, _parent.Font, base.HeaderText); g.DrawString(base.HeaderText as String, _parent.Font, textColor, pt.X, pt.Y + 2); /* * g.FillPath(Brushes.Gainsboro, new GraphicsPath( * new PointF[]{ * new PointF(e.CellBounds.Right-10, e.CellBounds.Top+4), * new PointF(e.CellBounds.Right-10, e.CellBounds.Bottom -4), * new PointF(e.CellBounds.Right-3, (e.CellBounds.Top + e.CellBounds.Bottom)/2)}, * new byte[]{ * (byte)PathPointType.Start,(byte)PathPointType.Line,(byte)PathPointType.Line}, FillMode.Winding)); */ e.Handled = true; } }