Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I solved a similar problem by creating a custom cell type, and shrinking the editing control as Bryan described. It's not terribly difficult, and it's the only way I'm aware of to keep the editing control from drawing on top of everything.</p> <p>Something like this ought to work for you:</p> <pre><code>public class PaintAccommodatingTextBoxCell : DataGridViewTextBoxCell { // Adjust the editing panel, so that custom painting isn't // drawn over when cells go into edit mode. public override Rectangle PositionEditingPanel(Rectangle cellBounds, Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) { // First, let base class do its adjustments Rectangle controlBounds = base.PositionEditingPanel(cellBounds, cellClip, cellStyle, singleVerticalBorderAdded, singleHorizontalBorderAdded, isFirstDisplayedColumn, isFirstDisplayedRow); // Shrink the bounds here... return controlBounds; } } public class PaintAccommodatingTextBoxColumn : DataGridViewTextBoxColumn { PaintAccommodatingTextBoxCell templateCell; public PaintAccommodatingTextBoxColumn() { templateCell = new PaintAccommodatingTextBoxCell(); } public override DataGridViewCell CellTemplate { get { return templateCell; } set { PaintAccommodatingTextBoxCell newTemplate = value as PaintAccommodatingTextBoxCell; if (newTemplate == null) throw new ArgumentException("Template must be a PaintAccommodatingTextBoxCell"); else templateCell = newTemplate; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload