protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle initCellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { //IEasyGridCell baseCell = GetSpanBaseCell(); //DataGridViewCell cell = baseCell as DataGridViewCell; cellStyle.BackColor = CellFunctions.BackColor(this); String text = this.Text; Rectangle textArea = getTextArea(initCellBounds); PaintCell(textArea, g); Rectangle buttonArea = getButtonArea(initCellBounds); //g.FillRectangle(Brushes.Gray, getButtonArea(initCellBounds)); CellFunctions.DrawLensBack(this, buttonArea, g, DataGridView.GridColor, false, this.Enabled); g.DrawString("...", _font, Brushes.Black, new Point(buttonArea.X + 5, buttonArea.Y)); //PaintCell(initCellBounds, g); /* * if (baseCell.Equals(this) == false) * { * //do nothing.. * * } * else * { * PaintCell(initCellBounds, g); * } */ paintParts = DataGridViewPaintParts.None; }
protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { if (_enabled == false) { g.FillRectangle(new SolidBrush(Color.WhiteSmoke), cellBounds); //g.DrawRectangle(new Pen(Color.FromArgb(200,200,200), 0.5f), cellBounds); //int textY = CellFunctions.TextCenterYInRact(cellBounds, g, _font);// cellBounds.Y + (int)((cellBounds.Height - textSize.Height) / 2.0); Point textPos = CellFunctions.TextCenterInRact(cellBounds, g, _font, this.Text); g.DrawString(Text, _font, _fontColor, textPos.X, textPos.Y); g.DrawLine(new Pen(_parent.GridColor, 0.1f), cellBounds.X, cellBounds.Y + cellBounds.Height - 1, cellBounds.X + cellBounds.Width, cellBounds.Y + cellBounds.Height - 1); g.DrawLine(new Pen(Color.FromArgb(200, 200, 200), 0.1f), cellBounds.X + cellBounds.Width - 1, cellBounds.Y, cellBounds.X + cellBounds.Width - 1, cellBounds.Y + cellBounds.Height - 1); } else { Brush textColor = CellFunctions.DrawLensBack(this, cellBounds, g, _parent.GridColor, this.Selected, _enabled); Point pt = CellFunctions.TextCenterInRact(cellBounds, g, _parent.Font, this.Text); g.DrawString(this.Text as String, _parent.Font, textColor, pt.X, pt.Y); } paintParts = DataGridViewPaintParts.None; base.Paint(g, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); /* * 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; }