SIL.FieldWorks.Common.Controls.FwBasicGrid.OnCellPainting C# (CSharp) Method

OnCellPainting() protected method

Get rid of focus rectangle if applicable.
protected OnCellPainting ( System.Windows.Forms.DataGridViewCellPaintingEventArgs e ) : void
e System.Windows.Forms.DataGridViewCellPaintingEventArgs
return void
		protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
		{
			bool doPaint = false;

			if (e.ColumnIndex == CurrentCellAddress.X && e.RowIndex == CurrentCellAddress.Y)
			{
				e.CellStyle.SelectionBackColor = m_selCellBackColor;
				e.CellStyle.SelectionForeColor = m_selCellForeColor;

				if (!m_drawSelectedCellFocusRect)
				{
					DataGridViewPaintParts parts = e.PaintParts;
					parts &= ~DataGridViewPaintParts.Focus;

					// Grr. PaintParts is readonly. So I have to brute force it.
					ReflectionHelper.SetField(e, "paintParts", parts);
					doPaint = true;
				}
			}

			base.OnCellPainting(e);

			if (!e.Handled && doPaint)
			{
				e.Paint(e.ClipBounds, e.PaintParts);
				e.Handled = true;
			}
		}