/// <summary> /// Draw the cell specified /// </summary> /// <param name="p_Cell">The cell.</param> /// <param name="p_CellPosition">The cell position.</param> /// <param name="e">Paint arguments</param> /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param> public virtual void DrawCell(Cells.ICellVirtual p_Cell, Position p_CellPosition, PaintEventArgs e, Rectangle p_ClientRectangle) { GridVirtual l_Grid = p_Cell.Grid; if (p_Cell.DataModel == null || p_Cell.DataModel.EnableCellDrawOnEdit || p_Cell.IsEditing(p_CellPosition) == false) { Graphics g = e.Graphics; // Set the clip region with the cell rectangle (for a bug in the PaintBorders function) Region l_PreviousClip = g.Clip; g.Clip = new Region(p_ClientRectangle); DrawCellStatus l_Status; if (l_Grid.FocusCellPosition == p_CellPosition) { // focus l_Status = DrawCellStatus.Focus; } else if (p_Cell.Grid.Selection.Contains(p_CellPosition)) { // selected l_Status = DrawCellStatus.Selected; } else { l_Status = DrawCellStatus.Normal; } DrawCell_Background(p_Cell, p_CellPosition, e, p_ClientRectangle, l_Status); DrawCell_Border(p_Cell, p_CellPosition, e, p_ClientRectangle, l_Status); DrawCell_ImageAndText(p_Cell, p_CellPosition, e, p_ClientRectangle, l_Status); // Reset the clip region g.Clip = l_PreviousClip; } }